upgrade node.js version during installation if version too old
This commit is contained in:
@@ -144,6 +144,8 @@ function InstallDependenciesCentOS {
|
|||||||
cmdlog "curl -s -L https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash -"
|
cmdlog "curl -s -L https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash -"
|
||||||
curl -s -L https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash - >>$LOGFILE 2>&1
|
curl -s -L https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash - >>$LOGFILE 2>&1
|
||||||
printok "Installing node.js"
|
printok "Installing node.js"
|
||||||
|
else
|
||||||
|
UpdateNodeYarn install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# only install yarn repo and package if not found
|
# only install yarn repo and package if not found
|
||||||
@@ -274,20 +276,8 @@ function InstallDependenciesDebian {
|
|||||||
cmdlog "apt-get install -y nodejs"
|
cmdlog "apt-get install -y nodejs"
|
||||||
apt-get install -y nodejs >>$LOGFILE 2>&1
|
apt-get install -y nodejs >>$LOGFILE 2>&1
|
||||||
printok "Installing node.js"
|
printok "Installing node.js"
|
||||||
fi
|
else
|
||||||
|
UpdateNodeYarn install
|
||||||
# if we run Debian 10 and have default nodejs v10 installed, then replace it with newer
|
|
||||||
if [[ $OSVERSION == "10" ]]; then
|
|
||||||
NODEV=$(node -v 2>/dev/null| grep -Eo '[0-9.]+' | cut -d'.' -f1)
|
|
||||||
if [[ -n $NODEV ]] && [[ $NODEV -lt ${NODEVERSION} ]]; then
|
|
||||||
echo
|
|
||||||
printprog "Installing node.js"
|
|
||||||
cmdlog "curl -sL https://deb.nodesource.com/setup_${NODEVERSION}.x | bash -"
|
|
||||||
curl -sL https://deb.nodesource.com/setup_${NODEVERSION}.x | bash - >>$LOGFILE 2>&1
|
|
||||||
cmdlog "apt-get install -y nodejs"
|
|
||||||
apt-get install -y nodejs >>$LOGFILE 2>&1
|
|
||||||
printok "Installing node.js"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# only install yarn repo and package if not found
|
# only install yarn repo and package if not found
|
||||||
@@ -339,11 +329,16 @@ function UpdateNodeYarn {
|
|||||||
yum install -y nodejs >>LOGFILE 2>&1
|
yum install -y nodejs >>LOGFILE 2>&1
|
||||||
printok "node.js version is $NODEV, upgrading to ${NODEVERSION}.x"
|
printok "node.js version is $NODEV, upgrading to ${NODEVERSION}.x"
|
||||||
else
|
else
|
||||||
|
if [[ $1 == "update" ]]; then
|
||||||
echo
|
echo
|
||||||
printprog "node.js version already on $NODEV, checking updates"
|
printprog "node.js version already on $NODEV, checking updates"
|
||||||
cmdlog "yum update -y nodejs yarn"
|
cmdlog "yum update -y nodejs yarn"
|
||||||
yum update -y nodejs yarn >>$LOGFILE 2>&1
|
yum update -y nodejs yarn >>$LOGFILE 2>&1
|
||||||
printok "node.js version already on $NODEV, checking updates"
|
printok "node.js version already on $NODEV, checking updates"
|
||||||
|
elif [[ $1 == "install" ]]; then
|
||||||
|
echo
|
||||||
|
printinfo "node.js version already on $NODEV"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
@@ -358,11 +353,16 @@ function UpdateNodeYarn {
|
|||||||
apt-get install -y nodejs >>$LOGFILE 2>&1
|
apt-get install -y nodejs >>$LOGFILE 2>&1
|
||||||
printok "node.js version is $NODEV, upgrading to ${NODEVERSION}.x"
|
printok "node.js version is $NODEV, upgrading to ${NODEVERSION}.x"
|
||||||
else
|
else
|
||||||
|
if [[ $1 == "update" ]]; then
|
||||||
echo
|
echo
|
||||||
printprog "node.js version already on $NODEV, checking updates"
|
printprog "node.js version already on $NODEV, checking updates"
|
||||||
cmdlog "apt-get install -y --only-upgrade nodejs yarn"
|
cmdlog "apt-get install -y --only-upgrade nodejs yarn"
|
||||||
apt-get install -y --only-upgrade nodejs yarn >>$LOGFILE 2>&1
|
apt-get install -y --only-upgrade nodejs yarn >>$LOGFILE 2>&1
|
||||||
printok "node.js version already on $NODEV, checking updates"
|
printok "node.js version already on $NODEV, checking updates"
|
||||||
|
elif [[ $1 == "install" ]]; then
|
||||||
|
echo
|
||||||
|
printinfo "node.js version already on $NODEV"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -727,7 +727,7 @@ function HandleArgs {
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
--update)
|
--update)
|
||||||
CheckMemory
|
CheckMemory
|
||||||
UpdateNodeYarn
|
UpdateNodeYarn update
|
||||||
UpdateXO
|
UpdateXO
|
||||||
;;
|
;;
|
||||||
--install)
|
--install)
|
||||||
@@ -989,7 +989,7 @@ read -p ": " option
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
UpdateNodeYarn
|
UpdateNodeYarn update
|
||||||
UpdateXO
|
UpdateXO
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
Reference in New Issue
Block a user