diff --git a/install.sh b/install.sh index 8172390..8df8c5b 100755 --- a/install.sh +++ b/install.sh @@ -52,12 +52,28 @@ nvm_profile_is_bash_or_zsh() { # # Outputs the location to NVM depending on: # * The availability of $NVM_SOURCE +# * The presence of $NVM_INSTALL_GITHUB_REPO # * The method used ("script" or "git" in the script, defaults to "git") # NVM_SOURCE always takes precedence unless the method is "script-nvm-exec" # nvm_source() { local NVM_GITHUB_REPO NVM_GITHUB_REPO="${NVM_INSTALL_GITHUB_REPO:-nvm-sh/nvm}" + if [ "${NVM_GITHUB_REPO}" != 'nvm-sh/nvm' ]; then + { nvm_echo >&2 "$(cat)" ; } << EOF +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ WARNING: REMOTE REPO IDENTIFICATION HAS CHANGED! @ +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! + +The default repository for this install is \`nvm-sh/nvm\`, +but the environment variables \`\$NVM_INSTALL_GITHUB_REPO\` is +currently set to \`${NVM_GITHUB_REPO}\`. + +If this is not intentional, interrupt this installation and +verify your environment variables. +EOF + fi local NVM_VERSION NVM_VERSION="${NVM_INSTALL_VERSION:-$(nvm_latest_version)}" local NVM_METHOD diff --git a/test/install_script/nvm_source b/test/install_script/nvm_source index 140afd5..82e25aa 100755 --- a/test/install_script/nvm_source +++ b/test/install_script/nvm_source @@ -30,7 +30,7 @@ out=$(nvm_source "anything" 2>&1 >/dev/null) || : #Saving the process here [ -z "$out" ] && die "nvm_source with invalid parameter should error out" #nvm_source should always return NVM_SOURCE no matter the parameters -NVM_SOURCE="my_location" +export NVM_SOURCE="my_location" out=$(nvm_source) [ "_$out" = "_my_location" ] || die "nvm_source without arguments should have returned \$NVM_SOURCE. Got \"$out\"" out=$(nvm_source "git")