slitaz-dev-tools rev 142

tazdev chroot: update aufs jail conf
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 14 11:50:43 2012 +0100 (2012-02-14)
parents dd373f91a950
children 436434a9cf4c
files tazdev/tazdev
line diff
     1.1 --- a/tazdev/tazdev	Tue Jan 10 11:09:20 2012 +0000
     1.2 +++ b/tazdev/tazdev	Tue Feb 14 11:50:43 2012 +0100
     1.3 @@ -97,6 +97,21 @@
     1.4  	fi
     1.5  }
     1.6  
     1.7 +# Bind a directory into the chroot
     1.8 +bind_chroot_dir()
     1.9 +{
    1.10 +	mkdir -p $1 $2
    1.11 +	mount -o bind $1 $2
    1.12 +
    1.13 +	# Update aufs jail configuration
    1.14 +	if [ "${2#*/home}" != "$2" ] &&
    1.15 +	   grep -s ^AUFS_MOUNTS= ${2%/home/*}/etc/slitaz/cook.conf &&
    1.16 +	   ! grep -q /home${2#*/home} ${2%/home/*}/etc/slitaz/cook.conf; then
    1.17 +		sed -i "s|^AUFS_MOUNTS=\"|&/home${2#*/home}|" \
    1.18 +			${2%/home/*}/etc/slitaz/cook.conf
    1.19 +	fi
    1.20 +}
    1.21 +
    1.22  # Mount virtual Kernel file systems and chroot but check that nobody
    1.23  # else has done mounts
    1.24  mount_chroot()
    1.25 @@ -113,13 +128,11 @@
    1.26  	# But do it only if it's a slitaz developement chroot.
    1.27  	fs=$rootfs/home/slitaz
    1.28  	if [ -d "$slitaz" ]; then
    1.29 -		mkdir -p $SLITAZ/src $fs/src
    1.30 -		mount -o bind $SLITAZ/src $fs/src
    1.31 +		bind_chroot_dir $SLITAZ/src $fs/src
    1.32  		# Now mount package dir so they are in /home/slitaz/$version
    1.33  		# We may not mount cache wok or others it has no point and if
    1.34  		# one want to use a shared wok he can bind it manually.
    1.35 -		mkdir -p $slitaz/packages $fs/packages
    1.36 -		mount -o bind $slitaz/packages $fs/packages
    1.37 +		bind_chroot_dir $slitaz/packages $fs/packages
    1.38  	fi
    1.39  }
    1.40