install.sh: Improve brew integration and documentation
This commit is contained in:
parent
cd193e52c7
commit
7ecdc82824
4 changed files with 38 additions and 26 deletions
|
|
@ -162,8 +162,13 @@ main() {
|
|||
detect)
|
||||
case "$OS" in
|
||||
macos)
|
||||
log "detected macOS, using homebrew for (un)installation"
|
||||
METHOD=homebrew
|
||||
if command -v brew >/dev/null; then
|
||||
log "detected macOS with homebrew, using homebrew for (un)installation"
|
||||
METHOD=homebrew
|
||||
else
|
||||
warn "detected macOS without homebrew, falling back to --method=standalone"
|
||||
METHOD=standalone
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
warn "unrecognized OS $OS, falling back to --method=standalone"
|
||||
|
|
@ -181,8 +186,14 @@ main() {
|
|||
|
||||
if [ -n "${UNINSTALL-}" ]; then
|
||||
uninstall
|
||||
if [ -n "${DRY_RUN-}" ]; then
|
||||
log "Rerun without --dry-run to execute printed commands and perform uninstall."
|
||||
fi
|
||||
else
|
||||
install
|
||||
if [ -n "${DRY_RUN-}" ]; then
|
||||
log "Rerun without --dry-run to execute printed commands and perform install."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -313,7 +324,6 @@ install_d2_brew() {
|
|||
header "installing d2 with homebrew"
|
||||
sh_c brew tap terrastruct/d2
|
||||
sh_c brew install d2
|
||||
sh_c brew test d2
|
||||
}
|
||||
|
||||
install_tala_standalone() {
|
||||
|
|
@ -361,7 +371,6 @@ install_tala_brew() {
|
|||
header "installing tala with homebrew"
|
||||
sh_c brew tap terrastruct/d2
|
||||
sh_c brew install tala
|
||||
sh_c brew test tala
|
||||
}
|
||||
|
||||
uninstall() {
|
||||
|
|
@ -492,4 +501,9 @@ fetch_gh() {
|
|||
sh_c mv "$file.inprogress" "$file"
|
||||
}
|
||||
|
||||
brew() {
|
||||
# Makes brew sane.
|
||||
HOMEBREW_NO_INSTALL_CLEANUP=1 HOMEBREW_NO_AUTO_UPDATE=1 command brew "$@"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
|||
|
|
@ -65,8 +65,7 @@ language. Sometimes it gives controversial sentences -- don't use those.
|
|||
Script to generate one line of random text:
|
||||
```
|
||||
ipsum1() {
|
||||
fortune | head -n1 | sed 's/^ *//;s/ *$//' | tr -d '\n' | pbcopy
|
||||
echo "$(pbpaste -Prefer txt)"
|
||||
fortune | head -n1 | sed 's/^ *//;s/ *$//' | tr -d '\n' | tee /dev/stderr | pbcopy
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# install
|
||||
|
||||
This file documents how the install.sh script installs d2 and how you can
|
||||
manually install yourself.
|
||||
This file documents all the ways by which you can install d2.
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
|
|
@ -59,8 +58,6 @@ The install script places the standalone release into `$PREFIX/lib/d2/d2-<versio
|
|||
and we recommend doing the same with manually installed releases so that you
|
||||
know where the release directory is for easy uninstall.
|
||||
|
||||
We have releases with identical process for tala at https://github.com/terrastruct/TALA/releases
|
||||
|
||||
## macOS (Homebrew)
|
||||
|
||||
For macOS you may install as so:
|
||||
|
|
@ -68,16 +65,4 @@ For macOS you may install as so:
|
|||
```sh
|
||||
brew tap terrastruct/d2
|
||||
brew install d2
|
||||
brew test d2
|
||||
```
|
||||
|
||||
For closed source TALA [https://github.com/terrastruct/tala]:
|
||||
|
||||
```sh
|
||||
brew tap terrastruct/d2
|
||||
brew install tala
|
||||
brew test tala
|
||||
```
|
||||
|
||||
You don't have to run the `brew test` command but we recommend it to ensure d2 is
|
||||
functioning correctly after installation.
|
||||
|
|
|
|||
22
install.sh
22
install.sh
|
|
@ -626,8 +626,13 @@ main() {
|
|||
detect)
|
||||
case "$OS" in
|
||||
macos)
|
||||
log "detected macOS, using homebrew for (un)installation"
|
||||
METHOD=homebrew
|
||||
if command -v brew >/dev/null; then
|
||||
log "detected macOS with homebrew, using homebrew for (un)installation"
|
||||
METHOD=homebrew
|
||||
else
|
||||
warn "detected macOS without homebrew, falling back to --method=standalone"
|
||||
METHOD=standalone
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
warn "unrecognized OS $OS, falling back to --method=standalone"
|
||||
|
|
@ -645,8 +650,14 @@ main() {
|
|||
|
||||
if [ -n "${UNINSTALL-}" ]; then
|
||||
uninstall
|
||||
if [ -n "${DRY_RUN-}" ]; then
|
||||
log "Rerun without --dry-run to execute printed commands and perform uninstall."
|
||||
fi
|
||||
else
|
||||
install
|
||||
if [ -n "${DRY_RUN-}" ]; then
|
||||
log "Rerun without --dry-run to execute printed commands and perform install."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -777,7 +788,6 @@ install_d2_brew() {
|
|||
header "installing d2 with homebrew"
|
||||
sh_c brew tap terrastruct/d2
|
||||
sh_c brew install d2
|
||||
sh_c brew test d2
|
||||
}
|
||||
|
||||
install_tala_standalone() {
|
||||
|
|
@ -825,7 +835,6 @@ install_tala_brew() {
|
|||
header "installing tala with homebrew"
|
||||
sh_c brew tap terrastruct/d2
|
||||
sh_c brew install tala
|
||||
sh_c brew test tala
|
||||
}
|
||||
|
||||
uninstall() {
|
||||
|
|
@ -956,4 +965,9 @@ fetch_gh() {
|
|||
sh_c mv "$file.inprogress" "$file"
|
||||
}
|
||||
|
||||
brew() {
|
||||
# Makes brew sane.
|
||||
HOMEBREW_NO_INSTALL_CLEANUP=1 HOMEBREW_NO_AUTO_UPDATE=1 command brew "$@"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
|||
Loading…
Reference in a new issue