Update install_terminal

added support for switching between rpm nodejs and nvm nodejs
This commit is contained in:
LPJon
2023-08-31 03:29:29 -05:00
committed by GitHub
parent 6e5e604bd3
commit 642c5fe759

View File

@@ -13,7 +13,14 @@ function getsystemnodeversion {
/usr/bin/node -v
fi
}
function checkfornodejsrpm {
yum list installed nodejs | grep nodejs
}
if [ "$usenvm" == "n" ]; then
if [ -e "$HOME/.nvm" ]; then
if [ -z "$(checkfornodejsrpm)" ]; then
rm -f /usr/bin/node
fi
if [ ! -e "/usr/bin/node" ];then
yum -y install nodejs --enablerepo=epel
cd /root
@@ -28,6 +35,9 @@ if [ "$usenvm" == "n" ]; then
cd /root
fi
elif [ "$usenvm" == "y" ]; then
if [ ! -z "$(checkfornodejsrpm)" ]; then
yum -y remove nodejs
fi
if [ -e "$HOME/.nvm" ];then
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm