diff --git a/.ci/install.sh b/.ci/install.sh index e86ae7a97..81c2f401b 100755 --- a/.ci/install.sh +++ b/.ci/install.sh @@ -168,29 +168,29 @@ setup_shell() { CONF_FILE=${ZDOTDIR:-$HOME}/.zshrc ensure_containing_dir_exists "$CONF_FILE" echo "Installing for Zsh. Appending the following to $CONF_FILE:" - echo "" - echo ' # fnm' - echo ' export PATH="'"$INSTALL_DIR"':$PATH"' - echo ' eval "`fnm env`"' - - echo '' >>$CONF_FILE - echo '# fnm' >>$CONF_FILE - echo 'export PATH="'$INSTALL_DIR':$PATH"' >>$CONF_FILE - echo 'eval "`fnm env`"' >>$CONF_FILE + { + echo '' + echo '# fnm' + echo 'FNM_PATH="'"$INSTALL_DIR"'"' + echo 'if [ -d "$FNM_PATH" ]; then' + echo ' export PATH="'$INSTALL_DIR':$PATH"' + echo ' eval "`fnm env`"' + echo 'fi' + } | tee -a "$CONF_FILE" elif [ "$CURRENT_SHELL" = "fish" ]; then CONF_FILE=$HOME/.config/fish/conf.d/fnm.fish ensure_containing_dir_exists "$CONF_FILE" echo "Installing for Fish. Appending the following to $CONF_FILE:" - echo "" - echo ' # fnm' - echo ' set PATH "'"$INSTALL_DIR"'" $PATH' - echo ' fnm env | source' - - echo '' >>$CONF_FILE - echo '# fnm' >>$CONF_FILE - echo 'set PATH "'"$INSTALL_DIR"'" $PATH' >>$CONF_FILE - echo 'fnm env | source' >>$CONF_FILE + { + echo '' + echo '# fnm' + echo 'set FNM_PATH "'"$INSTALL_DIR"'"' + echo 'if [ -d "$FNM_PATH" ]' + echo ' set PATH "$FNM_PATH" $PATH' + echo ' fnm env | source' + echo 'end' + } | tee -a "$CONF_FILE" elif [ "$CURRENT_SHELL" = "bash" ]; then if [ "$OS" = "Darwin" ]; then @@ -200,15 +200,15 @@ setup_shell() { fi ensure_containing_dir_exists "$CONF_FILE" echo "Installing for Bash. Appending the following to $CONF_FILE:" - echo "" - echo ' # fnm' - echo ' export PATH="'"$INSTALL_DIR"':$PATH"' - echo ' eval "`fnm env`"' - - echo '' >>$CONF_FILE - echo '# fnm' >>$CONF_FILE - echo 'export PATH="'"$INSTALL_DIR"':$PATH"' >>$CONF_FILE - echo 'eval "`fnm env`"' >>$CONF_FILE + { + echo '' + echo '# fnm' + echo 'FNM_PATH="'"$INSTALL_DIR"'"' + echo 'if [ -d "$FNM_PATH" ]; then' + echo ' export PATH="$FNM_PATH:$PATH"' + echo ' eval "`fnm env`"' + echo 'fi' + } | tee -a "$CONF_FILE" else echo "Could not infer shell type. Please set up manually."