From 7b4e57fd01e28736b7e6af6cfccece734df2f5a9 Mon Sep 17 00:00:00 2001 From: LPJon <46533576+LPJon@users.noreply.github.com> Date: Wed, 30 Aug 2023 20:29:57 -0500 Subject: [PATCH] Update install_terminal Added support for NVM (Node Version Manager) --- install_terminal | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/install_terminal b/install_terminal index 61dc080..691ce90 100644 --- a/install_terminal +++ b/install_terminal @@ -2,18 +2,34 @@ # CWP INSTALL APP TERMINAL yum -y update ca-certificates -if [ ! -e "/usr/bin/node" ];then - yum -y install nodejs --enablerepo=epel -cd /root -npm cache clean -f -npm install -g n -n stable -PATH="$PATH" -fi +# NEW CODE +# Use NVM for node.js installation management. Options are "y" or "n" DEFAULT = n +usenvm=n +# Version of Node.js to install. DEFAULT = 16.18.1 +nodeversion=16.18.1 -if [ ! -e "/usr/bin/npm" ];then - yum -y install npm --enablerepo=epel -cd /root +if [ "$usenvm" == "n" ]; then + if [ ! -e "/usr/bin/node" ];then + yum -y install nodejs --enablerepo=epel + cd /root + npm cache clean -f + npm install -g n + n stable + PATH="$PATH" + fi + + if [ ! -e "/usr/bin/npm" ];then + yum -y install npm --enablerepo=epel + cd /root + fi +elif [ "$usenvm" == "y" ]; then + if [ ! -d "$HOME/.nvm" ]; then + yum -y install curl + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash + source ~/.bashrc + nvm install "$nodeversion" + nvm use "$nodeversion" + fi fi # Old Code