2022-11-11 09:17:06 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
set -eu
|
2022-11-12 22:19:09 +00:00
|
|
|
cd -- "$(dirname "$0")/.."
|
|
|
|
|
. ./scripts/lib.sh
|
2022-11-11 09:17:06 +00:00
|
|
|
|
|
|
|
|
main() {
|
2022-11-16 11:16:57 +00:00
|
|
|
if [ -z "${PREFIX-}" ]; then
|
2022-11-11 09:17:06 +00:00
|
|
|
echoerr "\$PREFIX must be set to a unix prefix directory from which to uninstall d2 like /usr/local"
|
2022-11-12 22:19:09 +00:00
|
|
|
return 1
|
2022-11-11 09:17:06 +00:00
|
|
|
fi
|
|
|
|
|
|
2022-12-01 20:26:32 +00:00
|
|
|
sh_c="sh_c"
|
|
|
|
|
if ! is_writable_dir "$PREFIX/bin"; then
|
|
|
|
|
sh_c="sudo_sh_c"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
"$sh_c" rm -f "$PREFIX/bin/d2"
|
|
|
|
|
"$sh_c" rm -f "$PREFIX/share/man/man1/d2.1"
|
2022-11-11 09:17:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main "$@"
|