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