From f38f169146097f2536bbc1923bf36c6f841a0f03 Mon Sep 17 00:00:00 2001 From: ronivay Date: Sun, 31 May 2020 13:00:03 +0300 Subject: [PATCH] add some more set flags --- xo-install.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/xo-install.sh b/xo-install.sh index 0d12be5..cb34236 100755 --- a/xo-install.sh +++ b/xo-install.sh @@ -98,6 +98,8 @@ function printinfo { function ErrorHandling { + set -eu + echo printfail "Something went wrong, exiting. Check $LOGFILE for more details and use rollback feature if needed" @@ -111,7 +113,7 @@ function ErrorHandling { function InstallDependenciesCentOS { - set -e + set -euo pipefail trap ErrorHandling ERR INT @@ -198,7 +200,7 @@ function InstallDependenciesCentOS { function InstallDependenciesDebian { - set -e + set -euo pipefail trap ErrorHandling ERR INT @@ -338,7 +340,7 @@ function UpdateNodeYarn { function InstallXOPlugins { - set -e + set -euo pipefail trap ErrorHandling ERR INT @@ -373,7 +375,7 @@ function InstallXOPlugins { function InstallXO { - set -e + set -euo pipefail trap ErrorHandling ERR INT @@ -641,7 +643,7 @@ function InstallXO { /bin/systemctl start xo-server >>$LOGFILE 2>&1 # no need to exit/trap on errors anymore - set +e + set +eo pipefail trap - ERR INT timeout 60 bash <<-"EOF" @@ -674,6 +676,8 @@ function UpdateXO { InstallXO + set -euo pipefail + if [[ "$PRESERVE" != "0" ]]; then # remove old builds. leave as many as defined in PRESERVE variable @@ -723,6 +727,8 @@ function HandleArgs { function RollBackInstallation { + set -euo pipefail + INSTALLATIONS=($(find $INSTALLDIR/xo-builds/ -maxdepth 1 -type d -name "xen-orchestra-*" 2>/dev/null)) if [[ $(echo ${#INSTALLATIONS[@]}) -le 1 ]]; then