summaryrefslogtreecommitdiffstats
path: root/bin/chroot-installation.sh
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2015-02-05 12:26:20 +0100
committerHolger Levsen <holger@layer-acht.org>2015-02-05 12:26:20 +0100
commit4da8931481331a5e8aa33deb796bfa430e88db89 (patch)
treea08e0d06e7dff8e9de268e9660726b35564e5a35 /bin/chroot-installation.sh
parent837a89b4ea3a4c26a429226c435988ede1ff7fdd (diff)
downloadjenkins.debian.net-4da8931481331a5e8aa33deb796bfa430e88db89.tar.xz
chroot-installation: another attempt to handle failures correctly...
Diffstat (limited to 'bin/chroot-installation.sh')
-rwxr-xr-xbin/chroot-installation.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/bin/chroot-installation.sh b/bin/chroot-installation.sh
index 0d761daa..1b6cf768 100755
--- a/bin/chroot-installation.sh
+++ b/bin/chroot-installation.sh
@@ -28,10 +28,10 @@ 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."
+ set -x
# test if $CHROOT_TARGET starts with /chroots/
if [ "${CHROOT_TARGET:0:9}" != "/chroots/" ] ; then
echo "HALP. CHROOT_TARGET = $CHROOT_TARGET"
@@ -40,8 +40,11 @@ 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 ! $SUCCESS ; then
+ echo "\$1 = $1"
+ if [ "$1" != "fine" ] ; then
exit 1
+ else
+ echo "Exiting cleanly."
fi
}
@@ -251,6 +254,5 @@ if [ "$3" != "" ] ; then
fi
trap - INT TERM EXIT
-SUCCESS=true
-cleanup_all
+cleanup_all fine