d2/ci/release/template/scripts/install.sh
Anmol Sethi 6e52966b52
install.sh: Improve default $PREFIX behaviour
As before we default to /usr/local but now we switch to ~/.local if
/usr/local if not accessible instead of prompting for sudo. Instead
of having an exception for macOS/arm64.

Of course if a user wants to install in /usr/local anyway, they can
still pass --prefix /usr/local to force installation into /usr/local
and prompt for sudo.
2022-12-05 22:15:58 -08:00

14 lines
283 B
Bash
Executable file

#!/bin/sh
set -eu
cd -- "$(dirname "$0")/.."
. ./scripts/lib.sh
main() {
ensure_prefix_sh_c
"$sh_c" mkdir -p "$PREFIX/bin"
"$sh_c" install ./bin/d2 "$PREFIX/bin/d2"
"$sh_c" mkdir -p "$PREFIX/share/man/man1"
"$sh_c" install ./man/d2.1 "$PREFIX/share/man/man1"
}
main "$@"