From: Reto Buerki Date: Thu, 6 Dec 2012 18:26:48 +0000 (+0100) Subject: Use do_on_exit() in build scripts for cleanup X-Git-Tag: 5.0.2rc1~1^2~78 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0cc40637997984029dbcc47234b47c5da8ea0cd2;p=thirdparty%2Fstrongswan.git Use do_on_exit() in build scripts for cleanup --- diff --git a/testing/scripts/build-baseimage b/testing/scripts/build-baseimage index 4b81c5cdbc..b8f7092163 100755 --- a/testing/scripts/build-baseimage +++ b/testing/scripts/build-baseimage @@ -32,6 +32,9 @@ log_action "Mounting cache to $CACHEDIR" mkdir -p $APTCACHE execute "mount -o bind $CACHEDIR $APTCACHE" +do_on_exit umount -l $APTCACHE +do_on_exit umount -l $LOOPDIR + log_action "Running debootstrap ($ROOTFSSUITE, $ROOTFSARCH)" execute "debootstrap --arch=$ROOTFSARCH --include=$PACKAGES $ROOTFSSUITE $LOOPDIR $ROOTFSMIRROR" @@ -45,6 +48,3 @@ do log_action "Disabling service $service" execute_chroot "update-rc.d -f $service remove" done - -execute "umount -l $APTCACHE" 0 -execute "umount -l $LOOPDIR" 0 diff --git a/testing/scripts/build-umlhostfs b/testing/scripts/build-umlhostfs index e5355988cd..b4efc0ecbd 100755 --- a/testing/scripts/build-umlhostfs +++ b/testing/scripts/build-umlhostfs @@ -36,6 +36,9 @@ else HOSTS=$* fi +# just to be sure +do_on_exit umount $LOOPDIR + for host in $HOSTS do log_action "Creating guest image for $host" @@ -56,6 +59,6 @@ do execute_chroot "chown -R openldap:openldap /var/lib/ldap" 0 fi sync - umount $LOOPDIR log_status 0 + umount $LOOPDIR done diff --git a/testing/scripts/build-umlrootfs b/testing/scripts/build-umlrootfs index 6c67a25342..a93adac4c0 100755 --- a/testing/scripts/build-umlrootfs +++ b/testing/scripts/build-umlrootfs @@ -41,6 +41,10 @@ mkdir -p $LOOPDIR/root/compile log_action "Mounting $ROOTFSCOMPILEDIR as /root/compile" execute "mount -o bind $ROOTFSCOMPILEDIR $LOOPDIR/root/compile" +do_on_exit umount $LOOPDIR/root/compile +do_on_exit umount $LOOPDIR/proc +do_on_exit umount $LOOPDIR + echo "Installing software from source" RECPDIR=$UMLTESTDIR/testing/scripts/recipes RECIPES=`ls $RECPDIR/*.mk | xargs -n1 basename` @@ -52,8 +56,6 @@ do execute_chroot "make SWANVERSION=$SWANVERSION -C /root/compile -f $r" done -umount $LOOPDIR/root/compile - log_action "Setting up shared build tree at /root/compile" echo "" >> $LOOPDIR/etc/fstab echo "none /root/compile hostfs $ROOTFSCOMPILEDIR" >> $LOOPDIR/etc/fstab @@ -61,6 +63,3 @@ log_status 0 log_action "Removing /etc/resolv.conf" execute "rm -f $LOOPDIR/etc/resolv.conf" - -execute "umount $LOOPDIR/proc" 0 -execute "umount $LOOPDIR" 0