Skip to content

Commit

Permalink
Prevent re-install
Browse files Browse the repository at this point in the history
  • Loading branch information
jdgjsag67251 committed Sep 18, 2023
1 parent 4e2149a commit 792b52c
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions image/scripts/setup_nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,27 @@ echo "Major: $MAJOR_NODE_VERSION"
echo "Minor: $MINOR_NODE_VERSION"

if [[ $MAJOR_NODE_VERSION == "14" && $MINOR_NODE_VERSION -ge 21 ]]; then
echo "Using Meteor's custom NodeJS v14 LTS version"
# https://hub.docker.com/layers/meteor/node/14.21.4/images/sha256-f4e19b4169ff617118f78866c2ffe392a7ef44d4e30f2f9fc31eef2c35ceebf3?context=explore
curl "https://static.meteor.com/dev-bundle-node-os/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" | tar xzf - -C /tmp/
NEW_PATH="/tmp/node-v$NODE_VERSION-linux-x64/bin"
export PATH="$NEW_PATH:$PATH"
echo "PATH=$NEW_PATH:\$PATH" >> ~/.bashrc
export NODE_PATH=$NEW_PATH
ENV_PATH=/tmp/node_env.sh
touch $ENV_PATH
source $ENV_PATH

if [[ $(node --version) == $INSTALLED_NODE_VERSION ]]; then
echo "The correct Node version is already installed ($(node --version))"
else
echo "Using Meteor's custom NodeJS v14 LTS version"
# https://hub.docker.com/layers/meteor/node/14.21.4/images/sha256-f4e19b4169ff617118f78866c2ffe392a7ef44d4e30f2f9fc31eef2c35ceebf3?context=explore
curl "https://static.meteor.com/dev-bundle-node-os/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" | tar xzf - -C /tmp/
NEW_PATH="/tmp/node-v$NODE_VERSION-linux-x64/bin"
# Save the new config to all environments
echo "export PATH=$NEW_PATH:\$PATH" >> $ENV_PATH
echo ". $ENV_PATH" >> ~/.shinit
echo ". $ENV_PATH" >> ~/.bashrc
. $ENV_PATH
# Save installed Node version
echo "export INSTALLED_NODE_VERSION=$(node --version)" >> $ENV_PATH
# Set Node path for onbuild-node.sh
export NODE_PATH=$NEW_PATH
fi
else
echo "Using NVM"
nvm install $NODE_VERSION
Expand Down

0 comments on commit 792b52c

Please sign in to comment.