Attempt to fix script install - no shadowing $NVM_SOURCE; nvm-exec and nvm.sh should not both use $NVM_SOURCE since they're different URLs.
Fixes #654.master
parent
3190effedd
commit
3d6b7976e7
26
install.sh
26
install.sh
|
@ -18,26 +18,26 @@ nvm_latest_version() {
|
||||||
# Outputs the location to NVM depending on:
|
# Outputs the location to NVM depending on:
|
||||||
# * The availability of $NVM_SOURCE
|
# * The availability of $NVM_SOURCE
|
||||||
# * The method used ("script" or "git" in the script, defaults to "git")
|
# * The method used ("script" or "git" in the script, defaults to "git")
|
||||||
# NVM_SOURCE always takes precedence
|
# NVM_SOURCE always takes precedence unless the method is "script-nvm-exec"
|
||||||
#
|
#
|
||||||
nvm_source() {
|
nvm_source() {
|
||||||
local NVM_METHOD
|
local NVM_METHOD
|
||||||
NVM_METHOD="$1"
|
NVM_METHOD="$1"
|
||||||
if [ -z "$NVM_SOURCE" ]; then
|
local NVM_SOURCE_URL
|
||||||
local NVM_SOURCE
|
NVM_SOURCE_URL="$NVM_SOURCE"
|
||||||
|
if [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
|
||||||
|
NVM_SOURCE_URL="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/nvm-exec"
|
||||||
|
elif [ -z "$NVM_SOURCE_URL" ]; then
|
||||||
if [ "_$NVM_METHOD" = "_script" ]; then
|
if [ "_$NVM_METHOD" = "_script" ]; then
|
||||||
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/nvm.sh"
|
NVM_SOURCE_URL="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/nvm.sh"
|
||||||
elif [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
|
|
||||||
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/nvm-exec"
|
|
||||||
elif [ "_$NVM_METHOD" = "_git" ] || [ -z "$NVM_METHOD" ]; then
|
elif [ "_$NVM_METHOD" = "_git" ] || [ -z "$NVM_METHOD" ]; then
|
||||||
NVM_SOURCE="https://github.com/creationix/nvm.git"
|
NVM_SOURCE_URL="https://github.com/creationix/nvm.git"
|
||||||
else
|
else
|
||||||
echo >&2 "Unexpected value \"$NVM_METHOD\" for \$NVM_METHOD"
|
echo >&2 "Unexpected value \"$NVM_METHOD\" for \$NVM_METHOD"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "$NVM_SOURCE"
|
echo "$NVM_SOURCE_URL"
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_download() {
|
nvm_download() {
|
||||||
|
@ -74,8 +74,8 @@ install_nvm_from_git() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install_nvm_as_script() {
|
install_nvm_as_script() {
|
||||||
local NVM_SOURCE
|
local NVM_SOURCE_LOCAL
|
||||||
NVM_SOURCE=$(nvm_source script)
|
NVM_SOURCE_LOCAL=$(nvm_source script)
|
||||||
local NVM_EXEC_SOURCE
|
local NVM_EXEC_SOURCE
|
||||||
NVM_EXEC_SOURCE=$(nvm_source script-nvm-exec)
|
NVM_EXEC_SOURCE=$(nvm_source script-nvm-exec)
|
||||||
|
|
||||||
|
@ -86,8 +86,8 @@ install_nvm_as_script() {
|
||||||
else
|
else
|
||||||
echo "=> Downloading nvm as script to '$NVM_DIR'"
|
echo "=> Downloading nvm as script to '$NVM_DIR'"
|
||||||
fi
|
fi
|
||||||
nvm_download -s "$NVM_SOURCE" -o "$NVM_DIR/nvm.sh" || {
|
nvm_download -s "$NVM_SOURCE_LOCAL" -o "$NVM_DIR/nvm.sh" || {
|
||||||
echo >&2 "Failed to download '$NVM_SOURCE'"
|
echo >&2 "Failed to download '$NVM_SOURCE_LOCAL'"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
nvm_download -s "$NVM_EXEC_SOURCE" -o "$NVM_DIR/nvm-exec" || {
|
nvm_download -s "$NVM_EXEC_SOURCE" -o "$NVM_DIR/nvm-exec" || {
|
||||||
|
|
Loading…
Reference in New Issue