cookutils diff cook @ rev 696

cookutils: catch control-c in aufs jail
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Oct 25 10:08:20 2014 +0200 (2014-10-25)
parents 6b7249a17a47
children 32986dd964ae
line diff
     1.1 --- a/cook	Thu Sep 25 10:15:10 2014 +0200
     1.2 +++ b/cook	Sat Oct 25 10:08:20 2014 +0200
     1.3 @@ -900,6 +900,14 @@
     1.4  	fi
     1.5  }
     1.6  
     1.7 +# remove chroot jail
     1.8 +umount_aufs() {
     1.9 +	tac ${1}rw/aufs-umount.sh | sh
    1.10 +	rm -rf ${1}rw
    1.11 +	umount ${1}root
    1.12 +	rmdir $1*
    1.13 +}
    1.14 +
    1.15  # Launch the cook command into a chroot jail protected by aufs.
    1.16  # The current filesystems are used read-only and updates are
    1.17  # stored in a separate branch.
    1.18 @@ -933,15 +941,13 @@
    1.19  		fi
    1.20  		echo "umount ${base}root$mnt" >> ${base}rw/aufs-umount.sh
    1.21  	done
    1.22 +	trap "umount_aufs ${base}" INT
    1.23  
    1.24  	chroot ${base}root $(cd $(dirname $0); pwd)/$(basename $0) "$@"
    1.25  	status=$?
    1.26  
    1.27  	_ "Leaving aufs chroot..."
    1.28 -	tac ${base}rw/aufs-umount.sh | sh
    1.29 -	rm -rf ${base}rw
    1.30 -	umount ${base}root
    1.31 -	rmdir $base*
    1.32 +	umount_aufs ${base}
    1.33  	# Install package outside the aufs jail
    1.34  	install_package
    1.35  	exit $status