[Fix] `install.sh`: when `NVM_INSTALL_GITHUB_REPO` is set, issue a warning
This should only annoy those testing their PRs; real users should never set this env var
parent
d02ddcac2c
commit
4bdd57ba0f
16
install.sh
16
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
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue