From e7501de456e1f4d42ead34822227f953aa553ae6 Mon Sep 17 00:00:00 2001 From: Mykola Malkov Date: Fri, 27 Apr 2018 15:17:37 +0200 Subject: [PATCH] TT#35967 Run deployment.sh with errexit Add option -e to deplayment.sh to catch the installation's errors. Run deployment.sh as a script not via external interpreter 'bash '. Change-Id: I320b535f41f08937c4924c603f8e1a17b23e80e8 --- templates/scripts/includes/deployment.sh | 4 +++- templates/scripts/main.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) mode change 100644 => 100755 templates/scripts/includes/deployment.sh diff --git a/templates/scripts/includes/deployment.sh b/templates/scripts/includes/deployment.sh old mode 100644 new mode 100755 index ffd7b72..0930fef --- a/templates/scripts/includes/deployment.sh +++ b/templates/scripts/includes/deployment.sh @@ -2,6 +2,8 @@ # Purpose: automatically install Debian + sip:provider platform ################################################################################ +set -e + INSTALL_LOG='/tmp/deployment-installer-debug.log' exec > >(tee -a $INSTALL_LOG ) exec 2> >(tee -a $INSTALL_LOG >&2) @@ -1141,7 +1143,7 @@ clear_partition_table() { existing_pvs=$(pvs "$disk" -o vg_name --noheadings 2>/dev/null || true) if [ -n "$existing_pvs" ] ; then for pv in $existing_pvs ; do - logit "Getting rid of existing VG $pv on partition $part" + logit "Getting rid of existing VG $pv" vgremove -ff "$pv" done fi diff --git a/templates/scripts/main.sh b/templates/scripts/main.sh index ffacefd..52ed22a 100755 --- a/templates/scripts/main.sh +++ b/templates/scripts/main.sh @@ -128,7 +128,7 @@ deploy() { einfo "Running ${YELLOW}${version}${NORMAL} of deployment.sh..."; eend 0 RC=0 - TARGET_DISK="$TARGET_DISK" /bin/bash "${scripts_dir}/deployment.sh" || RC=$? + TARGET_DISK="$TARGET_DISK" "${scripts_dir}/deployment.sh" || RC=$? if [ $RC -eq 0 ] ; then if dialog --yes-label Reboot --no-label Exit --yesno "Successfully finished deployment, enjoy your sip:provider system. Reboot system now?" 0 0 ; then reboot