From 7a099ae010af0bb75430440d2b78c62c7344753a Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sun, 31 Jul 2022 20:44:23 -0500 Subject: [PATCH] feat: check for pre-existing autojump install --- install.bash | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/install.bash b/install.bash index 115cb00..a39c997 100755 --- a/install.bash +++ b/install.bash @@ -131,14 +131,18 @@ install-cargo-binary() { install-autojump() { local install_path="${1}/autojump" - cd "$(mktemp -d)" - git clone "https://github.com/wting/autojump.git" "autojump" || return 1 - ( - cd "autojump" - python3 "install.py" -d "${install_path}" - sed -i "s/\#\!\/usr\/bin\/env\ python/\#\!\/usr\/bin\/env\ python3/" \ - "${install_path}/bin/autojump" - ) || return 1 + if ! [[ -e "${install_path}" ]]; then + cd "$(mktemp -d)" + git clone "https://github.com/wting/autojump.git" "autojump" || return 1 + ( + cd "autojump" + python3 "install.py" -d "${install_path}" + sed -i "s/\#\!\/usr\/bin\/env\ python/\#\!\/usr\/bin\/env\ python3/" \ + "${install_path}/bin/autojump" + ) || return 1 + else + log "info" "${GREEN}Autojump${RESET_BOLD} already installed, skipping" + fi }