diff --git a/ci/release/_install.sh b/ci/release/_install.sh index aa9c4ef22..c266341cc 100755 --- a/ci/release/_install.sh +++ b/ci/release/_install.sh @@ -171,22 +171,25 @@ main() { install() { install_d2 - if [ "${TALA-}" ]; then + if [ -n "${TALA-}" ]; then # Run in subshell to avoid overwriting VERSION. - ( install_tala ) + TALA_VERSION="$( install_tala && echo "$VERSION" )" fi COLOR=2 header success log "d2-$VERSION-$OS-$ARCH has been successfully installed into $PREFIX" + if [ -n "${TALA-}" ]; then + log "tala-$TALA_VERSION-$OS-$ARCH has been successfully installed into $PREFIX" + fi if ! echo "$PATH" | grep -qF "$PREFIX/bin"; then logcat >&2 <&2 </dev/null; then - echoerr "no version of d2 installed" - return 1 + warn "no version of d2 installed" + return 0 fi INSTALLED_VERSION="$(d2 --version)" if ! uninstall_d2; then @@ -275,8 +285,8 @@ uninstall() { fi if [ "${TALA-}" ]; then if ! command -v d2plugin-tala >/dev/null; then - echoerr "no version of tala installed" - return 1 + warn "no version of tala installed" + return 0 fi INSTALLED_VERSION="$(d2plugin-tala --version)" if ! uninstall_tala; then @@ -296,7 +306,8 @@ uninstall_standalone_d2() { log "uninstalling standalone release of d2-$INSTALLED_VERSION" if [ ! -e "$INSTALL_DIR/d2-$INSTALLED_VERSION" ]; then - echoerr "missing standalone install release directory $INSTALL_DIR/d2-$INSTALLED_VERSION" + warn "missing standalone install release directory $INSTALL_DIR/d2-$INSTALLED_VERSION" + warn "d2 have been installed via some other installation method." return 1 fi @@ -310,14 +321,16 @@ uninstall_standalone_d2() { } uninstall_tala() { - uninstall_standalone_tala + header "uninstalling tala-$INSTALLED_VERSION" + uninstall_standalone_tala } uninstall_standalone_tala() { log "uninstalling standalone release tala-$INSTALLED_VERSION" if [ ! -e "$INSTALL_DIR/tala-$INSTALLED_VERSION" ]; then - echoerr "missing standalone install release directory $INSTALL_DIR/tala-$INSTALLED_VERSION" + warn "missing standalone install release directory $INSTALL_DIR/tala-$INSTALLED_VERSION" + warn "tala have been installed via some other installation method." return 1 fi @@ -332,10 +345,10 @@ uninstall_standalone_tala() { is_prefix_writable() { sh_c "mkdir -p '$INSTALL_DIR' 2>/dev/null" || true - # The reason for checking whether bin is writable specifically is that on macOS you have + # The reason for checking whether $INSTALL_DIR is writable is that on macOS you have # /usr/local owned by root but you don't need root to write to its subdirectories which # is all we want to do. - if [ ! -w "$PREFIX/bin" ]; then + if [ ! -w "$INSTALL_DIR" ]; then return 1 fi } diff --git a/ci/release/template/scripts/uninstall.sh b/ci/release/template/scripts/uninstall.sh index a41b449c9..d195463f3 100755 --- a/ci/release/template/scripts/uninstall.sh +++ b/ci/release/template/scripts/uninstall.sh @@ -10,7 +10,7 @@ main() { fi sh_c rm -f "$PREFIX/bin/d2" - sh_c rm -f "$PREFIX/share/man/man1" + sh_c rm -f "$PREFIX/share/man/man1/d2.1" } main "$@" diff --git a/ci/sub b/ci/sub index a2da81bcb..9271a707d 160000 --- a/ci/sub +++ b/ci/sub @@ -1 +1 @@ -Subproject commit a2da81bcbc12c9ce4f53d8e74385d0d93184484d +Subproject commit 9271a707dc1d1fdca60599269c81e1ecdd6623e7 diff --git a/install.sh b/install.sh index 520870b54..90fbc3501 100755 --- a/install.sh +++ b/install.sh @@ -605,22 +605,25 @@ main() { install() { install_d2 - if [ "${TALA-}" ]; then + if [ -n "${TALA-}" ]; then # Run in subshell to avoid overwriting VERSION. - ( install_tala ) + TALA_VERSION="$( install_tala && echo "$VERSION" )" fi COLOR=2 header success log "d2-$VERSION-$OS-$ARCH has been successfully installed into $PREFIX" + if [ -n "${TALA-}" ]; then + log "tala-$TALA_VERSION-$OS-$ARCH has been successfully installed into $PREFIX" + fi if ! echo "$PATH" | grep -qF "$PREFIX/bin"; then logcat >&2 <&2 </dev/null; then - echoerr "no version of d2 installed" - return 1 + warn "no version of d2 installed" + return 0 fi INSTALLED_VERSION="$(d2 --version)" if ! uninstall_d2; then @@ -709,8 +719,8 @@ uninstall() { fi if [ "${TALA-}" ]; then if ! command -v d2plugin-tala >/dev/null; then - echoerr "no version of tala installed" - return 1 + warn "no version of tala installed" + return 0 fi INSTALLED_VERSION="$(d2plugin-tala --version)" if ! uninstall_tala; then @@ -730,7 +740,8 @@ uninstall_standalone_d2() { log "uninstalling standalone release of d2-$INSTALLED_VERSION" if [ ! -e "$INSTALL_DIR/d2-$INSTALLED_VERSION" ]; then - echoerr "missing standalone install release directory $INSTALL_DIR/d2-$INSTALLED_VERSION" + warn "missing standalone install release directory $INSTALL_DIR/d2-$INSTALLED_VERSION" + warn "d2 have been installed via some other installation method." return 1 fi @@ -744,14 +755,16 @@ uninstall_standalone_d2() { } uninstall_tala() { - uninstall_standalone_tala + header "uninstalling tala-$INSTALLED_VERSION" + uninstall_standalone_tala } uninstall_standalone_tala() { log "uninstalling standalone release tala-$INSTALLED_VERSION" if [ ! -e "$INSTALL_DIR/tala-$INSTALLED_VERSION" ]; then - echoerr "missing standalone install release directory $INSTALL_DIR/tala-$INSTALLED_VERSION" + warn "missing standalone install release directory $INSTALL_DIR/tala-$INSTALLED_VERSION" + warn "tala have been installed via some other installation method." return 1 fi @@ -766,10 +779,10 @@ uninstall_standalone_tala() { is_prefix_writable() { sh_c "mkdir -p '$INSTALL_DIR' 2>/dev/null" || true - # The reason for checking whether bin is writable specifically is that on macOS you have + # The reason for checking whether $INSTALL_DIR is writable is that on macOS you have # /usr/local owned by root but you don't need root to write to its subdirectories which # is all we want to do. - if [ ! -w "$PREFIX/bin" ]; then + if [ ! -w "$INSTALL_DIR" ]; then return 1 fi }