From d9bbaad632410a685af13bd83b7bf8fadc0ee947 Mon Sep 17 00:00:00 2001 From: Fabricio Augusto Date: Wed, 18 May 2022 18:10:27 +0100 Subject: [PATCH] Change nvm load to if block --- root/etc/cont-init.d/98-nvm | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/root/etc/cont-init.d/98-nvm b/root/etc/cont-init.d/98-nvm index b0642ab..13b6a93 100644 --- a/root/etc/cont-init.d/98-nvm +++ b/root/etc/cont-init.d/98-nvm @@ -1,23 +1,16 @@ #!/usr/bin/with-contenv bash +NVM_DIR="$HOME/.nvm" + echo "**** installing nvm ****" -export NVM_DIR="$HOME/.nvm" -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash +if [ ! -s "$NVM_DIR/nvm.sh" ]; then + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash -echo "**** loading nvm ****" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" -# This loads nvm bash_completion -[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" + echo "**** loading nvm ****" + source "$NVM_DIR/nvm.sh" -echo "**** installing the current stable LTS release of Node.js ****" -nvm install --lts - -echo "**** switching to the current stable LTS release of Node.js ****" -nvm use --lts - -echo "**** installing yarn ****" -npm install -g yarn - -mkdir -p /config/.config -chown -R abc /config/.config -chown -R abc /config/.nvm \ No newline at end of file + echo "**** installing the latest release ****" + nvm install node +else + echo "**** nvm already installed, skipping ****" +fi