[Fix] `install.sh`: only un-interpolate $HOME for the profile source string.
Fixes #1384.
parent
affcc5087c
commit
6fc0241c21
10
install.sh
10
install.sh
|
@ -7,7 +7,7 @@ nvm_has() {
|
|||
}
|
||||
|
||||
nvm_install_dir() {
|
||||
printf %s "${NVM_DIR:-"$HOME/.nvm"}" | sed "s:^$HOME:\$HOME:"
|
||||
printf %s "${NVM_DIR:-"$HOME/.nvm"}"
|
||||
}
|
||||
|
||||
nvm_latest_version() {
|
||||
|
@ -290,10 +290,10 @@ nvm_do_install() {
|
|||
|
||||
local NVM_PROFILE
|
||||
NVM_PROFILE="$(nvm_detect_profile)"
|
||||
local INSTALL_DIR
|
||||
INSTALL_DIR="$(nvm_install_dir)"
|
||||
local PROFILE_INSTALL_DIR
|
||||
PROFILE_INSTALL_DIR="$(nvm_install_dir| sed "s:^$HOME:\$HOME:")"
|
||||
|
||||
SOURCE_STR="\nexport NVM_DIR=\"$INSTALL_DIR\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && \\. \"\$NVM_DIR/nvm.sh\" # This loads nvm\n"
|
||||
SOURCE_STR="\nexport NVM_DIR=\"${PROFILE_INSTALL_DIR}\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && \\. \"\$NVM_DIR/nvm.sh\" # This loads nvm\n"
|
||||
COMPLETION_STR="[ -s \"\$NVM_DIR/bash_completion\" ] && \\. \"\$NVM_DIR/bash_completion\" # This loads nvm bash_completion\n"
|
||||
BASH_OR_ZSH=false
|
||||
|
||||
|
@ -331,7 +331,7 @@ nvm_do_install() {
|
|||
|
||||
# Source nvm
|
||||
# shellcheck source=/dev/null
|
||||
\. "${INSTALL_DIR}/nvm.sh"
|
||||
\. "$(nvm_install_dir)/nvm.sh"
|
||||
|
||||
nvm_check_global_modules
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ unset NVM_DIR
|
|||
|
||||
# NVM_DIR is not set
|
||||
install_dir=$(nvm_install_dir)
|
||||
[ "_$install_dir" = "_\$HOME/.nvm" ] || die "nvm_install_dir should default to \$HOME/.nvm. Current output: $install_dir"
|
||||
[ "_$install_dir" = "_$HOME/.nvm" ] || die "nvm_install_dir should default to \$HOME/.nvm. Current output: $install_dir"
|
||||
|
||||
cleanup
|
||||
|
||||
|
|
Loading…
Reference in New Issue