From 14a9148159ae6058011a74a079b612078236aa48 Mon Sep 17 00:00:00 2001 From: LPJon <46533576+LPJon@users.noreply.github.com> Date: Thu, 31 Aug 2023 05:17:33 -0500 Subject: [PATCH] Update install_netdata Changed the way the current NVM Node.JS file path is obtained to be used for the system symbolic link --- install_netdata | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/install_netdata b/install_netdata index 055e65b..fff923b 100644 --- a/install_netdata +++ b/install_netdata @@ -20,6 +20,9 @@ function getsystemnodeversion { /usr/bin/node -v fi } +function currentnodefilepath { + nvm which current +} function checkfornodejsrpm { yum list installed nodejs | grep nodejs } @@ -40,10 +43,10 @@ function installnodeJS { [ -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 @@ -51,9 +54,9 @@ function installnodeJS { export NVM_DIR="$HOME/.nvm" [ -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" - ln -sf /root/.nvm/versions/node/v"$nodeversion"/bin/node /usr/bin/node - nvm use system + ln -sf $(currentnodefilepath) /usr/bin/node fi fi }