cookutils diff cook @ rev 286

cook: add aufs_chroot jail (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Feb 13 16:18:57 2012 +0100 (2012-02-13)
parents 7b46752d788a
children 0d08acc6d3c3
line diff
     1.1 --- a/cook	Mon Feb 13 15:51:04 2012 +0100
     1.2 +++ b/cook	Mon Feb 13 16:18:57 2012 +0100
     1.3 @@ -765,16 +765,17 @@
     1.4  # stored in a separate branch.
     1.5  try_aufs_chroot() {
     1.6  
     1.7 +	base=/dev/shm/aufsmnt$$
     1.8 +
     1.9  	# Can we setup the chroot ? Is it already done ?
    1.10  	[ -n "$AUFS_MOUNTS" -a ! -f /aufs-umount.sh ] || return
    1.11  	lsmod | grep -q aufs || modprobe aufs 2> /dev/null || return
    1.12 +	mkdir ${base}root ${base}rw || return
    1.13  
    1.14  	echo "Setup aufs chroot..."
    1.15 -	base=/dev/shm/aufsmnt$$
    1.16 -	mkdir ${base}root ${base}rw
    1.17  
    1.18  	# Sanity check
    1.19 -	for i in / /proc /sys /dev/shm ; do
    1.20 +	for i in / /proc /sys /dev/shm /home ; do
    1.21  		case " $AUFS_MOUNTS " in
    1.22  		*\ $i\ *) ;;
    1.23  		*)	AUFS_MOUNTS="$AUFS_MOUNTS $i" ;;
    1.24 @@ -790,13 +791,11 @@
    1.25  		fi
    1.26  		echo "umount ${base}root$mnt" >> ${base}rw/aufs-umount.sh
    1.27  	done
    1.28 -	mount --bind /home ${base}root/home
    1.29  
    1.30  	chroot ${base}root $(cd $(dirname $0); pwd)/$(basename $0) "$@"
    1.31  	status=$?
    1.32  
    1.33  	echo "Leave aufs chroot..."
    1.34 -	umount ${base}root/home
    1.35  	tac ${base}rw/aufs-umount.sh | sh
    1.36  	rm -rf ${base}rw
    1.37  	umount ${base}root