From 039aa9e56ae669d500dfba2739dc47772c7011d3 Mon Sep 17 00:00:00 2001 From: LPJon <46533576+LPJon@users.noreply.github.com> Date: Thu, 31 Aug 2023 05:11:56 -0500 Subject: [PATCH] Update install_terminal Changed the way the current NVM Node.JS file path is obtained to be used for the system symbolic link --- install_terminal | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/install_terminal b/install_terminal index 5b4b497..162ec77 100644 --- a/install_terminal +++ b/install_terminal @@ -16,6 +16,9 @@ function getsystemnodeversion { function checkfornodejsrpm { yum list installed nodejs | grep nodejs } +function currentnodefilepath { + nvm which current +} if [ "$usenvm" == "n" ]; then if [ -e "$HOME/.nvm" ]; then if [ -z "$(checkfornodejsrpm)" ]; then @@ -44,10 +47,10 @@ elif [ "$usenvm" == "y" ]; then [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion nvm install $nodeversion + nvm use $nodeversion if [ "$(getsystemnodeversion)" != "v$nodeversion" ]; then - ln -sf /root/.nvm/versions/node/v"$nodeversion"/bin/node /usr/bin/node + ln -sf $(currentnodefilepath) /usr/bin/node fi - nvm use system fi if [ ! -e "$HOME/.nvm" ]; then yum -y install curl @@ -56,8 +59,8 @@ elif [ "$usenvm" == "y" ]; then [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion nvm install "$nodeversion" - ln -sf /root/.nvm/versions/node/v"$nodeversion"/bin/node /usr/bin/node - nvm use system + nvm use $nodeversion + ln -sf $(currentnodefilepath) /usr/bin/node fi fi