Install nvm-exec as well when installing via script.
Fixes #553.
diff --git a/install.sh b/install.sh
index 5296e47..ae9d866 100755
--- a/install.sh
+++ b/install.sh
@@ -28,6 +28,8 @@
fi
if [ "_$NVM_METHOD" = "_script" ]; then
NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.18.0/nvm.sh"
+ elif [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
+ NVM_SOURCE="https://raw.githubusercontent.com/creationix/nvm/v0.18.0/nvm-exec"
elif [ "_$NVM_METHOD" = "_git" ] || [ -z "$NVM_METHOD" ]; then
NVM_SOURCE="https://github.com/creationix/nvm.git"
else
@@ -74,6 +76,8 @@
install_nvm_as_script() {
local NVM_SOURCE
NVM_SOURCE=$(nvm_source "script")
+ local NVM_EXEC_SOURCE
+ NVM_EXEC_SOURCE=$(nvm_source "script-nvm-exec")
# Downloading to $NVM_DIR
mkdir -p "$NVM_DIR"
@@ -83,9 +87,17 @@
echo "=> Downloading nvm as script to '$NVM_DIR'"
fi
nvm_download -s "$NVM_SOURCE" -o "$NVM_DIR/nvm.sh" || {
- echo >&2 "Failed to download '$NVM_SOURCE'.."
+ echo >&2 "Failed to download '$NVM_SOURCE'"
return 1
}
+ nvm_download -s "$NVM_EXEC_SOURCE" -o "$NVM_DIR/nvm-exec" || {
+ echo >&2 "Failed to download '$NVM_EXEC_SOURCE'"
+ return 2
+ }
+ chmod a+x "$NVM_DIR/nvm-exec" || {
+ echo >&2 "Failed to mark '$NVM_DIR/nvm-exec' as executable"
+ return 3
+ }
}
#
diff --git a/test/install_script/nvm_source b/test/install_script/nvm_source
index 94c773f..8307639 100755
--- a/test/install_script/nvm_source
+++ b/test/install_script/nvm_source
@@ -17,6 +17,9 @@
# nvm_source with script parameter returns the location of nvm.sh
echo $(nvm_source "script") | grep "nvm.sh$" > /dev/null || die "nvm_source \"script\" should return the location of nvm.sh"
+# nvm_source with script-nvm-exec parameter returns the location of nvm-exec
+echo $(nvm_source "script-nvm-exec") | grep "nvm-exec$" > /dev/null || die "nvm_source \"script-nvm-exec\" should return the location of nvm.sh"
+
# nvm_source with any other parameter errors out and exits
nvm_source "anything" 2> /dev/null && die "nvm_source with invalid parameter should exit"
out=$(nvm_source "anything" 2>&1 >/dev/null) || : #Saving the process here