tazlito rev 105

Add tazlito upgrade-flavor
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Aug 19 23:14:06 2009 +0200 (2009-08-19)
parents 78b1b9a2e4fe
children b322fa520f21
files tazlito
line diff
     1.1 --- a/tazlito	Wed Aug 19 18:47:23 2009 +0000
     1.2 +++ b/tazlito	Wed Aug 19 23:14:06 2009 +0200
     1.3 @@ -83,6 +83,7 @@
     1.4    gen-liveflavor  Generate a live-CD description from current system.
     1.5    show-flavor     Show live-CD description.
     1.6    get-flavor      Get a flavor's list of packages.
     1.7 +  upgrade-flavor  Update package list to the latest available versions.
     1.8    check-list      Check a distro-packages.list for updates.
     1.9    extract-distro  Extract an ISO to a directory and rebuild LiveCD tree.
    1.10    gen-distro      Generate a Live distro and ISO from a list of packages.
    1.11 @@ -756,6 +757,39 @@
    1.12  		echo "Flavor size : `du -sh $FLAVOR.flavor`"
    1.13  		echo ""
    1.14  		;;
    1.15 +	upgrade-flavor)
    1.16 +		# Update package list to the lastest versions available.
    1.17 +		FLAVOR=$2
    1.18 +		if [ -f $FLAVOR.flavor ] || download $FLAVOR.flavor; then
    1.19 +			mkdir $TMP_DIR
    1.20 +			zcat $FLAVOR.flavor | ( cd $TMP_DIR; cpio -i 2>/dev/null )
    1.21 +			echo -n "Update $FLAVOR package list..."
    1.22 +			sed -i -e 's/size\( *:\) \(.*\)/size\1 unknown/' \
    1.23 +			       -e 's/is ready/not built yet/' \
    1.24 +			       -e 's/date\( *:\) \(.*\)/date\1 not built yet/' \
    1.25 +					$TMP_DIR/$FLAVOR.desc
    1.26 +			[ -s /var/lib/tazpkg/packages.list ] || tazpkg recharge
    1.27 +			while read org; do
    1.28 +				i=0
    1.29 +				pkg=$org
    1.30 +				while ! grep -q ^$pkg /var/lib/tazpkg/packages.list; do
    1.31 +					pkg=${pkg%-*}
    1.32 +					i=$(($i + 1))
    1.33 +					[ $i -gt 5 ] && break;
    1.34 +				done
    1.35 +				for i in $(grep ^$pkg /var/lib/tazpkg/packages.list); do
    1.36 +					echo $i
    1.37 +					break
    1.38 +				done
    1.39 +			done <  $TMP_DIR/$FLAVOR.pkglist \
    1.40 +			     > $TMP_DIR/$FLAVOR.pkglist.$$
    1.41 +			mv -f $TMP_DIR/$FLAVOR.pkglist.$$ $TMP_DIR/$FLAVOR.pkglist
    1.42 +			( cd $TMP_DIR ; ls | cpio -o -H newc ) | gzip -9 > \
    1.43 +				$FLAVOR.flavor
    1.44 +			status
    1.45 +			rm -Rf $TMP_DIR
    1.46 +		fi
    1.47 +		;;
    1.48  	get-flavor)
    1.49  		# Get a flavor's files and prepare for gen-distro.
    1.50  		FLAVOR=$2