Update NodeJS and Yarn packages before running xo update. Prevent issue where install fails because of outdated package

This commit is contained in:
ronivay
2018-07-24 08:34:06 +03:00
parent 5ebbe6e4a0
commit 6da4b7e09d

View File

@@ -26,6 +26,8 @@ LOGFILE="$(dirname $0)/xo-install.log"
# comma separated list of plugins to be installed, check README for more information
#PLUGINS="xo-server-transport-email,xo-server-usage-report,xo-server-perf-alert"
# NodeJS and Yarn are automatically updated when running update. Switch this option to false if you want to disable it.
AUTOUPDATE="true"
### End of editable variables ###
@@ -141,6 +143,23 @@ function InstallDependenciesDebian {
} 2>$LOGFILE
function UpdateNodeYarn {
if [[ $AUTOUPDATE == "true" ]]; then
if [ $OSNAME == "CentOS" ]; then
echo
echo "Checking updates for nodejs and yarn"
yum update -y nodejs yarn > /dev/null
else
echo
echo "Checking updates for nodejs and yarn"
apt-get update -y nodejs yarn > /dev/null
fi
fi
} 2>$LOGFILE
function InstallXOPlugins {
if [[ "$PLUGINS" ]] && [[ ! -z "$PLUGINS" ]]; then
@@ -319,6 +338,7 @@ function UpdateXOAutomate {
case "$1" in
--update)
UpdateNodeYarn
UpdateXO
;;
*)
@@ -442,6 +462,7 @@ read -p ": " option
fi
;;
2)
UpdateNodeYarn
UpdateXO
exit 0
;;