slitaz-dev-tools rev 77

tazdev: fix gen-chroot if chrrot path is given in argument and add umount-chroot cmd
author Christophe Lincoln <pankso@slitaz.org>
date Tue May 03 14:52:07 2011 +0200 (2011-05-03)
parents 2ed2aa3f16a9
children bfce85497514
files tazdev/tazdev tazdev/tazdev.conf
line diff
     1.1 --- a/tazdev/tazdev	Fri Apr 29 11:03:18 2011 +0100
     1.2 +++ b/tazdev/tazdev	Tue May 03 14:52:07 2011 +0200
     1.3 @@ -10,16 +10,11 @@
     1.4  #     Pascal Bellard <bellard@slitaz.org>
     1.5  #
     1.6  
     1.7 -if [ -f /etc/slitaz/tazdev.conf ]; then
     1.8 -	CONFIG=/etc/slitaz/tazdev.conf
     1.9 -else [ -f $PWD/tazdev.conf ]
    1.10 -	CONFIG=$PWD/tazdev.conf
    1.11 -fi
    1.12 -if ! [ "$CONFIG" ]; then
    1.13 -	echo -e "\nNo config file found in /etc/slitaz or the current dir...\n"
    1.14 -	exit 0
    1.15 -else
    1.16 -	. $CONFIG
    1.17 +[ -f /etc/slitaz/tazdev.conf ] && . /etc/slitaz/tazdev.conf
    1.18 +[ -f $PWD/tazdev.conf ] && . $PWD/tazdev.conf
    1.19 +
    1.20 +if [ -z "$SLITAZ" ]; then
    1.21 +	echo -e "\nNo config file found\n" && exit 1
    1.22  fi
    1.23  
    1.24  usage()
    1.25 @@ -29,10 +24,10 @@
    1.26  \033[1mCommands: \033[0m\n
    1.27   usage               Print this short usage and command list
    1.28   projects-stats|-ps  Display statistics about your projects
    1.29 - cmplog              Log 'tazwok cmp' result (or use tazbb)
    1.30   update-wok          Update Hg wok and copy it to the chroot wok
    1.31   chroot              Mount virtual fs if needed and chroot into the build env
    1.32 - gen-chroot          Generate a chroot using the last cooking base rootfs
    1.33 + gen-chroot|-gs      Generate a chroot using the last cooking base rootfs
    1.34 + umount-chroot|-uc   Unmount chroot specified on cmdline (--forced to force)
    1.35   clean-chroot        Clean a chroot environment (skip root/ and home/)
    1.36   purge               Remove obsolete packages and obsolete source tarballs
    1.37   dry-purge           Show obsolete packages and obsolete source tarballs
    1.38 @@ -124,13 +119,14 @@
    1.39  	# Not working. Buggy ps ?
    1.40  	#sleep 6
    1.41  	ps=$(ps | grep `basename $0` | grep -v grep | wc -l)
    1.42 -	if [ "$ps" == "1" ]; then
    1.43 -		echo -ne "\Unmounting virtual filesystems..."
    1.44 +	if [ "$ps" == "1" ] || [ "$2" == "--forced" ]; then
    1.45 +		[ "$1" ] && ROOTF=$1
    1.46 +		echo -e "\nUnmounting virtual filesystems...\n"
    1.47  		umount $ROOTFS/dev/shm
    1.48  		umount $ROOTFS/dev/pts
    1.49  		umount $ROOTFS/sys
    1.50  		umount $ROOTFS/proc
    1.51 -		status
    1.52 +		echo ""
    1.53  	else
    1.54  		echo -e "\nProcess: $ps\n"
    1.55  		ps | grep `basename $0` | grep -v grep
    1.56 @@ -206,12 +202,6 @@
    1.57  }
    1.58  
    1.59  case "$1" in
    1.60 -	cmplog)
    1.61 -		# Log 'tazwok cmp' for the web interface (can be used via a cron job).
    1.62 -		check_root
    1.63 -		echo -e "Starting 'tazwok cmp' (can be long)...\n"
    1.64 -		tazwok cmp | grep ^[A-Z] | tee $CMP_LOG
    1.65 -		echo "Date: `date`" >> $CMP_LOG ;;
    1.66  	projects-stats|-ps)
    1.67  		echo -e "\nStatistics for: $PROJECTS\n"
    1.68  		echo -n "Project" && echo -ne "\033[24G Size" && echo -ne "\033[38G Revision"
    1.69 @@ -262,9 +252,15 @@
    1.70  		chroot $ROOTFS /bin/sh --login
    1.71  		umount_chroot
    1.72  		echo -e "Exiting $ROOTFS chroot environment...\n" ;;
    1.73 -	gen-chroot)
    1.74 +	umount-chroot|-uc)
    1.75  		check_root
    1.76 -		get_version $@
    1.77 +		[ "$2" ] && ROOTFS=$2
    1.78 +		[ "$3" ] && opt=$3
    1.79 +		umount_chroot $ROOTFS $opt ;;
    1.80 +	gen-chroot|-gc)
    1.81 +		check_root
    1.82 +		[ "$2" ] && ROOTFS=$2
    1.83 +		[ "$2" ] || ROOTFS=$SLITAZ/cooking/chroot
    1.84  		# Dont break another env.
    1.85  		if [ -d $ROOTFS/bin ]; then
    1.86  			echo -e "\nA chroot environment already exists in : $ROOTFS\n"
     2.1 --- a/tazdev/tazdev.conf	Fri Apr 29 11:03:18 2011 +0100
     2.2 +++ b/tazdev/tazdev.conf	Tue May 03 14:52:07 2011 +0200
     2.3 @@ -1,19 +1,17 @@
     2.4  # tazdev.conf: SliTaz Developers tool configuration file.
     2.5  #
     2.6  
     2.7 -# Path to 'tazwok cmp' log file.
     2.8 -CMP_LOG="/var/log/tazwok-cmp.log"
     2.9 -
    2.10  # Path for the wok, chroot and packages directory of each version.
    2.11 -COOKING="/home/slitaz/cooking"
    2.12 -STABLE="/home/slitaz/stable"
    2.13 -UNDIGEST="/home/slitaz/undigest"
    2.14 +SLITAZ="/home/slitaz"
    2.15 +COOKING="$SLITAZ/cooking"
    2.16 +STABLE="$SLITAZ/stable"
    2.17 +UNDIGEST="$SLITAZ/undigest"
    2.18  
    2.19  # Path to all own and copy projects.
    2.20  PROJECTS="$HOME/Projects"
    2.21  
    2.22  # Destination for generated images ISO
    2.23 -ISO=$HOME/Desktop
    2.24 +ISO=$SLITAZ/iso
    2.25  
    2.26  # Main mirror to push and download (ISO, rootfs. etc).
    2.27  MIRROR="mirror.slitaz.org"