slitaz-dev-tools rev 80

tazdev: mount src and packages
author Christophe Lincoln <pankso@slitaz.org>
date Fri May 06 23:58:23 2011 +0200 (2011-05-06)
parents 6fb1b56d3bd5
children 03279ff7b32b
files tazdev/tazdev
line diff
     1.1 --- a/tazdev/tazdev	Fri May 06 16:53:43 2011 +0000
     1.2 +++ b/tazdev/tazdev	Fri May 06 23:58:23 2011 +0200
     1.3 @@ -74,8 +74,6 @@
     1.4  		SLITAZ=$COOKING
     1.5  	fi
     1.6  	ROOTFS=$SLITAZ/chroot
     1.7 -	HG_WOK=$SLITAZ/wok
     1.8 -	BUILD_WOK=$SLITAZ/chroot/home/slitaz/wok
     1.9  }
    1.10  
    1.11  check_mirror()
    1.12 @@ -103,35 +101,45 @@
    1.13  mount_chroot()
    1.14  {
    1.15  	if [ ! -d $ROOTFS/proc/1 ]; then
    1.16 -		echo -n "Mounting virtual filesystems..."
    1.17 +		echo -en "\nMounting virtual filesystems..."
    1.18  		mount -t proc proc $ROOTFS/proc
    1.19  		mount -t sysfs sysfs $ROOTFS/sys
    1.20  		mount -t devpts devpts $ROOTFS/dev/pts
    1.21  		mount -t tmpfs shm $ROOTFS/dev/shm
    1.22  		status
    1.23  	fi
    1.24 +	# Mount source so they can be shared between cooking/stable/undigest.
    1.25 +	# But do it only if it's a slitaz developement chroot.
    1.26 +	fs=$ROOTFS/home/slitaz
    1.27 +	if [ -d "$SLITAZ" ]; then
    1.28 +		mkdir -p $SLITAZ/src $fs/src
    1.29 +		mount -o bind $SLITAZ/src $fs/src
    1.30 +		# Now mount package dir so they are in /home/slitaz/$VERSION
    1.31 +		# We may not mount cache wok or others it has no point and if
    1.32 +		# one want to use a shared wok he can bind it manually.
    1.33 +		mkdir -p $SLITAZ/$VERSION/packages $fs/packages
    1.34 +		mount -o bind $SLITAZ/$VERSION/packages $fs/packages
    1.35 +	fi
    1.36  }
    1.37  
    1.38  # Unmount virtual Kernel file systems on exit and ensure we are the last
    1.39  # user before unmounting !
    1.40  umount_chroot()
    1.41  {
    1.42 -	# Not working. Buggy ps ?
    1.43 -	#sleep 6
    1.44 -	ps=$(ps | grep `basename $0` | grep -v grep | wc -l)
    1.45 -	if [ "$ps" == "1" ] || [ "$2" == "--forced" ]; then
    1.46 -		[ "$1" ] && ROOTF=$1
    1.47 -		echo -e "\nUnmounting virtual filesystems...\n"
    1.48 -		umount $ROOTFS/dev/shm
    1.49 -		umount $ROOTFS/dev/pts
    1.50 -		umount $ROOTFS/sys
    1.51 -		umount $ROOTFS/proc
    1.52 -		echo ""
    1.53 -	else
    1.54 -		echo -e "\nProcess: $ps\n"
    1.55 -		ps | grep `basename $0` | grep -v grep
    1.56 -		echo -e "\nLeaving virtual filesystems unmounted (`pidof tazdev`)...\n"
    1.57 -	fi
    1.58 +	[ "$1" ] && ROOTF=$1
    1.59 +	fs=$ROOTFS/home/slitaz
    1.60 +	echo -e "\nChroot: $ROOTFS"
    1.61 +	echo -n "Unmounting virtual filesystems..."
    1.62 +	umount $ROOTFS/dev/shm
    1.63 +	umount $ROOTFS/dev/pts
    1.64 +	umount $ROOTFS/sys
    1.65 +	umount $ROOTFS/proc
    1.66 +	umount $fs/src
    1.67 +	umount $fs/packages
    1.68 +	echo -e "Done\n"
    1.69 +	#echo -e "\nProcess: $ps\n"
    1.70 +	#ps | grep `basename $0` | grep -v grep
    1.71 +	#echo -e "\nLeaving virtual filesystems unmounted (`pidof tazdev`)...\n"
    1.72  }
    1.73  
    1.74  # Get the last cooking base rootfs, extract and configure.
    1.75 @@ -227,22 +235,6 @@
    1.76  		done
    1.77  		echo "================================================================================"
    1.78  		echo "" ;;
    1.79 -	update-wok)
    1.80 -		# Update the Hg wok and copy it to the chroot env. Hg wok is
    1.81 -		# copied to the chroot wok to avoid messing with build result
    1.82 -		# file and so we can also modify receipt directly without affecting
    1.83 -		# the Hg wok.
    1.84 -		check_root
    1.85 -		get_version $@
    1.86 -		echo ""
    1.87 -		echo "Hg wok    : $HG_WOK"
    1.88 -		echo "Build wok : $BUILD_WOK"
    1.89 -		cd $HG_WOK
    1.90 -		hg pull && hg update
    1.91 -		echo -n "Copying Hg wok to the build wok... "
    1.92 -		cp -a $HG_WOK/* $BUILD_WOK
    1.93 -		cp -a $HG_WOK/.hg $BUILD_WOK
    1.94 -		status && echo "" ;;
    1.95  	chroot)
    1.96  		# Chroot into a build env. Default to cooking configured in
    1.97  		# tazdev.conf
    1.98 @@ -250,15 +242,14 @@
    1.99  		get_version $@
   1.100  		[ -d "$2" ] && ROOTFS=$2
   1.101  		mount_chroot
   1.102 -		echo -e "\nChrooting in $ROOTFS...\n"
   1.103 +		echo -e "Chrooting in $ROOTFS...\n"
   1.104  		chroot $ROOTFS /bin/sh --login
   1.105 -		umount_chroot
   1.106 -		echo -e "Exiting $ROOTFS chroot environment...\n" ;;
   1.107 +		umount_chroot ;;
   1.108  	umount-chroot|-uc)
   1.109  		check_root
   1.110 +		get_version $@
   1.111  		[ "$2" ] && ROOTFS=$2
   1.112 -		[ "$3" ] && opt=$3
   1.113 -		umount_chroot $ROOTFS $opt ;;
   1.114 +		umount_chroot $ROOTFS ;;
   1.115  	gen-chroot|-gc)
   1.116  		check_root
   1.117  		get_version $@