Small logic fix

pull/165/head
FlorianGareis 1 year ago
parent ab190b0e58
commit 8976a3b317
No known key found for this signature in database

@ -5,28 +5,27 @@ BOLD='\033[0;1m'
CODE='\033[36;40;1m' CODE='\033[36;40;1m'
RESET='\033[0m' RESET='\033[0m'
printf "${BOLD}Installing nvm!${RESET}\n" printf "$${BOLD}Installing nvm!$${RESET}\n"
output=$(curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh | NVM_DIR=${INSTALL_PREFIX} bash) export NVM_DIR="${INSTALL_PREFIX}/nvm"
output=$(curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh | bash)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed to install nvm: $output" echo "Failed to install nvm: $output"
exit 1 exit 1
fi fi
printf "🥳 nvm has been installed\n\n" printf "🥳 nvm has been installed\n\n"
NVM="${INSTALL_PREFIX}/nvm.sh"
# Set up nvm in the current shell session # Set up nvm in the current shell session
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# Install each node version... # Install each node version...
IFS=',' read -r -a VERSIONLIST <<< "${NODE_VERSIONS}" IFS=',' read -r -a VERSIONLIST <<< "$${NODE_VERSIONS}"
for version in "${VERSIONLIST[@]}"; do for version in "$${VERSIONLIST[@]}"; do
if [ -z "$version" ]; then if [ -z "$version" ]; then
continue continue
fi fi
printf "🛠️ Installing node version ${CODE}$version${RESET}...\n" printf "🛠️ Installing node version $${CODE}$version$${RESET}...\n"
output=$(nvm install "$version") output=$(nvm install "$version")
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed to install version: $version: $output" echo "Failed to install version: $version: $output"
@ -36,6 +35,6 @@ done
# Set default if provided # Set default if provided
if [ -n "${DEFAULT}" ]; then if [ -n "${DEFAULT}" ]; then
printf "🛠️ Setting default node version ${CODE}$DEFAULT${RESET}...\n" printf "🛠️ Setting default node version $${CODE}$DEFAULT$${RESET}...\n"
output=$(nvm alias default $DEFAULT) output=$(nvm alias default $DEFAULT)
fi fi

Loading…
Cancel
Save