From 6cbf54320c768a731fd5257877665b0c88d1a934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Go=CC=88kay=20Gu=CC=88rcan?= Date: Thu, 1 Oct 2020 11:31:02 +0200 Subject: [PATCH] Improve nvm installer --- images/linux/scripts/installers/nvm.sh | 3 ++- images/macos/provision/core/nvm.sh | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/images/linux/scripts/installers/nvm.sh b/images/linux/scripts/installers/nvm.sh index 74fed1f2a..619eade84 100644 --- a/images/linux/scripts/installers/nvm.sh +++ b/images/linux/scripts/installers/nvm.sh @@ -7,7 +7,8 @@ export NVM_DIR="/etc/skel/.nvm" mkdir $NVM_DIR -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash +VERSION=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name') +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION/install.sh | bash echo 'export NVM_DIR=$HOME/.nvm' | tee -a /etc/skel/.bash_profile echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' | tee -a /etc/skel/.bash_profile [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" diff --git a/images/macos/provision/core/nvm.sh b/images/macos/provision/core/nvm.sh index 544bf2a32..527bd4c62 100755 --- a/images/macos/provision/core/nvm.sh +++ b/images/macos/provision/core/nvm.sh @@ -6,7 +6,8 @@ ########################################################################### source ~/utils/utils.sh -curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash +VERSION=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name') +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION/install.sh | bash if [ $? -eq 0 ]; then . ~/.bashrc @@ -23,13 +24,13 @@ if [ $? -eq 0 ]; then nvm alias node12 lts/erbium nvm alias node13 v13 nvm alias node14 v14 - + if is_Catalina || is_BigSur; then # set system node as default nvm alias default system fi else - echo error + echo error fi echo "Node version manager has been installed successfully"