From ef0ac3bc7edad0ccbf3e09b557e039bb1d43b2c4 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Wed, 28 Jan 2015 13:34:30 +0100 Subject: chroot-installation: try harder to exit correctly --- bin/chroot-installation.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bin/chroot-installation.sh') diff --git a/bin/chroot-installation.sh b/bin/chroot-installation.sh index b1daa4e7..8b23ff6e 100755 --- a/bin/chroot-installation.sh +++ b/bin/chroot-installation.sh @@ -27,6 +27,7 @@ export CHROOT_TARGET=$(mktemp -d -p /chroots/ chroot-installation-$1.XXXXXXXXX) export TMPFILE=$(mktemp -u) export CTMPFILE=$CHROOT_TARGET/$TMPFILE export TMPLOG=$(mktemp) +SUCCESS=false cleanup_all() { echo "Doing cleanup now." @@ -38,9 +39,7 @@ cleanup_all() { sudo umount -l $CHROOT_TARGET/proc || fuser -mv $CHROOT_TARGET/proc sudo rm -rf --one-file-system $CHROOT_TARGET || fuser -mv $CHROOT_TARGET rm -f $TMPLOG - if [ "$1" = "good" ] ; then - exit 0 - else + if ! $SUCCESS ; then exit 1 fi } @@ -251,5 +250,6 @@ if [ "$3" != "" ] ; then fi trap - INT TERM EXIT -cleanup_all good +SUCCESS=true +cleanup_all -- cgit v1.2.3-54-g00ecf