tazlito rev 217

Add extraction tools in loram builder for slitaz-installer : no extra package to install during install
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Apr 27 11:57:31 2011 +0200 (2011-04-27)
parents 5efb0b404472
children 88bd4377be4d
files tazlito
line diff
     1.1 --- a/tazlito	Sun Mar 06 21:10:08 2011 +0000
     1.2 +++ b/tazlito	Wed Apr 27 11:57:31 2011 +0200
     1.3 @@ -479,7 +479,7 @@
     1.4  			[ -f $2/$file ] && 
     1.5  			[ "$(basename $file)" == "volatile.cpio.gz" ] &&
     1.6  			[ "$(dirname $(dirname $file))" == \
     1.7 -			  "./var/lib/tazpkg/installed" ] && rm -f $2/$file
     1.8 +			  ".$INSTALLED" ] && rm -f $2/$file
     1.9  		elif [ -b $1/$file ]; then
    1.10  			[ -b $2/$file ] && rm -f $2/$file
    1.11  		elif [ -c $1/$file ]; then
    1.12 @@ -525,7 +525,7 @@
    1.13  
    1.14  get_size()
    1.15  {
    1.16 -cat /var/lib/tazpkg/packages.list $TMP_DIR/packages.list 2>/dev/null | awk "{ \
    1.17 +cat $LOCALSTATE/packages.list $TMP_DIR/packages.list 2>/dev/null | awk "{ \
    1.18  if (/^$(echo $1 | sed 's/[$+.\]/\\&/g')$/) get=1; \
    1.19  if (/installed/ && get == 1) { print ; get++ } \
    1.20  }
    1.21 @@ -544,7 +544,7 @@
    1.22  	set -- $(get_size $pkg)
    1.23  	packed_size=$(( $packed_size + $1 ))
    1.24  	unpacked_size=$(( $unpacked_size + $2 ))
    1.25 -	for i in $(grep -hs ^$pkg /var/lib/tazpkg/packages.list \
    1.26 +	for i in $(grep -hs ^$pkg $LOCALSTATE/packages.list \
    1.27  				  $TMP_DIR/packages.list); do
    1.28  		echo $i
    1.29  		break
    1.30 @@ -664,6 +664,8 @@
    1.31  		$TMP_DIR/initfs/lib
    1.32  	if [ -f /bin/cromfs-driver ]; then
    1.33  		cp /bin/cromfs-driver $TMP_DIR/initfs/bin
    1.34 +		ls /bin/unmkcromfs | \
    1.35 +			cpio -o -H newc > $TMP_DIR/initfs/extractfs.cpio
    1.36  	else
    1.37  		[ ! -f /usr/sbin/mksquashfs ] && ! install_package squashfs && return 1
    1.38  		while [ ! -f /lib/modules/$version/kernel/fs/squashfs/squashfs.ko.gz ]; do
    1.39 @@ -671,6 +673,8 @@
    1.40  		done
    1.41  		cp /lib/modules/$version/kernel/fs/squashfs/squashfs.ko.gz \
    1.42  			 $TMP_DIR/initfs/lib
    1.43 +		ls /sbin/unsquashfs /usr/lib/liblzma.so* $INSTALLED/squashfs/* | \
    1.44 +			cpio -o -H newc > $TMP_DIR/initfs/extractfs.cpio
    1.45  	fi
    1.46  	if [ "$1" == "cdrom" ]; then
    1.47  		for i in $(ls /dev/[hs]d[a-f]*); do
    1.48 @@ -1048,7 +1052,7 @@
    1.49  	      $1/dev/core $1/dev/fd $1/dev/std*
    1.50  			
    1.51  	# Verify md5
    1.52 -	cat $1/var/lib/tazpkg/installed/*/md5sum | \
    1.53 +	cat $1$INSTALLED/*/md5sum | \
    1.54  	while read md5 file; do
    1.55  		[ -e $1$file ] || continue
    1.56  		[ "$(cat $1$file | md5sum)" == "$md5  -" ] && 
    1.57 @@ -1056,7 +1060,7 @@
    1.58  	done
    1.59  	
    1.60  	# Check configuration files
    1.61 -	for i in $1/var/lib/tazpkg/installed/*/volatile.cpio.gz; do
    1.62 +	for i in $1$INSTALLED/*/volatile.cpio.gz; do
    1.63  		[ -e $i ] || continue
    1.64  		mkdir /tmp/volatile$$
    1.65  		zcat $i | ( cd /tmp/volatile$$ ; cpio -idmu > /dev/null )
    1.66 @@ -1068,7 +1072,7 @@
    1.67  	done
    1.68  	
    1.69  	# Remove other files blindly
    1.70 -	for i in $1/var/lib/tazpkg/installed/*/files.list; do
    1.71 +	for i in $1$INSTALLED/*/files.list; do
    1.72  		for file in $(cat $i); do
    1.73  			[ $1$file -nt $i ] && continue
    1.74  			[ -f $1$file -a ! -L $1$file ] && continue
    1.75 @@ -1077,9 +1081,9 @@
    1.76  	done
    1.77  	
    1.78  	# Remove tazpkg files and tmp files
    1.79 -	rm -rf $1/var/lib/tazpkg/installed* $1/tmp $1/var/tmp
    1.80 -	rm -f $1/var/lib/tazpkg/*packages* $1/var/lib/tazpkg/files.list.lzma \
    1.81 -		$1/var/lib/tazpkg/mirror*  $1/var/cache/*/* \
    1.82 +	rm -rf $1$INSTALLED* $1/tmp $1/var/tmp
    1.83 +	rm -f $1$LOCALSTATE/*packages* $1$LOCALSTATE/files.list.lzma \
    1.84 +		$1$LOCALSTATE/mirror*  $1/var/cache/*/* \
    1.85  		$1/var/lock/* $1/var/log/* $1/var/run/* $1/var/run/*/* \
    1.86  		$1/var/lib/*  $1/var/lib/dbus/* 2> /dev/null
    1.87  	
    1.88 @@ -1424,12 +1428,12 @@
    1.89  			mkdir $TMP_DIR
    1.90  			zcat $FLAVOR.flavor | ( cd $TMP_DIR; cpio -i >/dev/null )
    1.91  			echo -n "Updating $FLAVOR package list..."
    1.92 -			[ -s /var/lib/tazpkg/packages.list ] || tazpkg recharge
    1.93 +			[ -s $LOCALSTATE/packages.list ] || tazpkg recharge
    1.94  			packed_size=0; unpacked_size=0
    1.95  			while read org; do
    1.96  				i=0
    1.97  				pkg=$org
    1.98 -				while ! grep -q ^$pkg$ /var/lib/tazpkg/packages.txt; do
    1.99 +				while ! grep -q ^$pkg$ $LOCALSTATE/packages.txt; do
   1.100  					pkg=${pkg%-*}
   1.101  					i=$(($i + 1))
   1.102  					[ $i -gt 5 ] && break;
   1.103 @@ -1437,7 +1441,7 @@
   1.104  				set -- $(get_size $pkg)
   1.105  				packed_size=$(( $packed_size + $1 ))
   1.106  				unpacked_size=$(( $unpacked_size + $2 ))
   1.107 -				for i in $(grep ^$pkg /var/lib/tazpkg/packages.list); do
   1.108 +				for i in $(grep ^$pkg $LOCALSTATE/packages.list); do
   1.109  					echo $i
   1.110  					break
   1.111  				done
   1.112 @@ -1505,11 +1509,11 @@
   1.113  			[ -s $TMP_DIR/$FLAVOR.mirrors ] &&
   1.114  				cp $TMP_DIR/$FLAVOR.mirrors \
   1.115  					$FLAVORS_REPOSITORY/$FLAVOR/mirrors
   1.116 -			[ -s /var/lib/tazpkg/packages.list ] || tazpkg recharge
   1.117 +			[ -s $LOCALSTATE/packages.list ] || tazpkg recharge
   1.118  			while read org; do
   1.119  				i=0
   1.120  				pkg=$org
   1.121 -				while ! grep -q ^$pkg$ /var/lib/tazpkg/packages.txt; do
   1.122 +				while ! grep -q ^$pkg$ $LOCALSTATE/packages.txt; do
   1.123  					pkg=${pkg%-*}
   1.124  					i=$(($i + 1))
   1.125  					[ $i -gt 5 ] && break;
   1.126 @@ -1527,7 +1531,7 @@
   1.127  		if [ -s $FLAVORS_REPOSITORY/$FLAVOR/receipt ]; then
   1.128  			mkdir $TMP_DIR
   1.129  			echo -n "Creating flavor $FLAVOR..."
   1.130 -			[ -s /var/lib/tazpkg/packages.list ] || tazpkg recharge
   1.131 +			[ -s $LOCALSTATE/packages.list ] || tazpkg recharge
   1.132  			if [ -s $FLAVORS_REPOSITORY/$FLAVOR/mirrors ]; then
   1.133  				cp $FLAVORS_REPOSITORY/$FLAVOR/mirrors \
   1.134  					$TMP_DIR/$FLAVOR.mirrors
   1.135 @@ -1715,7 +1719,7 @@
   1.136  				rm -f $TMP_DIR/rootcd/boot/rootfs.gz $TMP_DIR/rootcd/md5sum
   1.137  				mv $TMP_DIR/rootcd/boot $TMP_DIR/rootfs
   1.138  				sed 's/.*  \(.*\).tazpkg*/\1/' > $TMP_DIR/$FLAVOR.pkglist \
   1.139 -					< $TMP_DIR/rootfs/var/lib/tazpkg/installed.md5
   1.140 +					< $TMP_DIR/rootfs$INSTALLED.md5
   1.141  				#[ -s $TMP_DIR/rootfs/etc/tazlito/distro-packages.list ] &&
   1.142  				#	mv $TMP_DIR/rootfs/etc/tazlito/distro-packages.list $TMP_DIR/$FLAVOR.pkglist
   1.143  				PKGCNT=$(grep -v ^# $TMP_DIR/$FLAVOR.pkglist | wc -l | awk '{ print $1 }')
   1.144 @@ -1772,7 +1776,7 @@
   1.145  		echo "================================================================================"
   1.146  		for pkg in `cat $DISTRO_PKGS_LIST`
   1.147  		do
   1.148 -			if ! grep -q "$pkg" /var/lib/tazpkg/packages.list; then
   1.149 +			if ! grep -q "$pkg" $LOCALSTATE/packages.list; then
   1.150  				echo "Updating: $pkg"
   1.151  				up=$(($up + 1))
   1.152  			fi
   1.153 @@ -2084,8 +2088,8 @@
   1.154  			status
   1.155  		fi
   1.156  		# Tazpkg mirror.
   1.157 -		if [ ! -f "$ROOTFS/var/lib/tazpkg/mirror" ]; then
   1.158 -			echo -n "Mirror URL   : Missing /var/lib/tazpkg/mirror"
   1.159 +		if [ ! -f "$ROOTFS$LOCALSTATE/mirror" ]; then
   1.160 +			echo -n "Mirror URL   : Missing $LOCALSTATE/mirror"
   1.161  			todomsg
   1.162  		else
   1.163  			echo -n "Mirror configuration exists..."