tazlito rev 439

May use advdef
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Oct 21 08:19:50 2016 +0200 (2016-10-21)
parents 3202ae99962f
children 392ce00aa117
files tazlito
line diff
     1.1 --- a/tazlito	Tue Oct 04 21:47:05 2016 +0100
     1.2 +++ b/tazlito	Fri Oct 21 08:19:50 2016 +0200
     1.3 @@ -382,6 +382,12 @@
     1.4  }
     1.5  
     1.6  
     1.7 +dogzip() {
     1.8 +	gzip -9 > $1
     1.9 +	[ -x /usr/bin/advdef ] && advdef -qz4 $1
    1.10 +}
    1.11 +
    1.12 +
    1.13  # Pack rootfs
    1.14  
    1.15  pack_rootfs() {
    1.16 @@ -393,7 +399,7 @@
    1.17  			;;
    1.18  		gzip)
    1.19  			_ 'Creating %s with gzip compression...' 'initramfs'
    1.20 -			gzip -9 > $2
    1.21 +			dogzip $2
    1.22  			;;
    1.23  		*)
    1.24  			_ 'Creating %s with lzma compression...' 'initramfs'
    1.25 @@ -418,8 +424,7 @@
    1.26  			;;
    1.27  		gzip)
    1.28  			_ 'Creating %s with gzip compression...' "$INITRAMFS"
    1.29 -			cpio -o -H newc | gzip -9 > "/$INITRAMFS"
    1.30 -			[ -x /usr/bin/advdef ] && advdef -z4 "/$INITRAMFS"
    1.31 +			cpio -o -H newc | dogzip "/$INITRAMFS"
    1.32  			;;
    1.33  		*)
    1.34  			# align='y'
    1.35 @@ -610,7 +615,7 @@
    1.36  			rm "$1.$i"
    1.37  		done
    1.38  		# Info to be stored inside ISO
    1.39 -		[ "$2" == info ] && echo -e $infos | cpio -o -H newc | gzip -9 > info
    1.40 +		[ "$2" == info ] && echo -e $infos | cpio -o -H newc | dogzip info
    1.41  		rm $1.list*
    1.42  
    1.43  		# Renames
    1.44 @@ -634,7 +639,7 @@
    1.45  # Pack flavor file from temp directory
    1.46  
    1.47  pack_flavor() {
    1.48 -	(cd "$1"; ls | grep -v err | cpio -o -H newc) | gzip -9 > "$2.flavor"
    1.49 +	(cd "$1"; ls | grep -v err | cpio -o -H newc) | dogzip "$2.flavor"
    1.50  }
    1.51  
    1.52  
    1.53 @@ -1086,7 +1091,7 @@
    1.54  	for i in $TMP_DIR/initfs/lib/modules/*z ; do
    1.55  		unxz $i || gunzip $i || lzma d $i ${i%.gz}
    1.56  		rm -f $i
    1.57 -		gzip -9 ${i%.gz}
    1.58 +		dogzip ${i%.gz}
    1.59  	done 2>/dev/null
    1.60  	(cd $TMP_DIR/initfs; find | busybox cpio -o -H newc 2>/dev/null) | \
    1.61  	lzma e $TMP_DIR/initfs.gz -si
    1.62 @@ -1872,7 +1877,7 @@
    1.63  			[ -s $i ] && cat $i >> $FLAVOR.mirrors
    1.64  		done
    1.65  		[ -s $FLAVOR.mirrors ] && $FILES="$FILES\n$FLAVOR.mirrors"
    1.66 -		echo -e "$FLAVOR.desc\n$FILES" | cpio -o -H newc 2>/dev/null | gzip -9 > $FLAVOR.flavor
    1.67 +		echo -e "$FLAVOR.desc\n$FILES" | cpio -o -H newc 2>/dev/null | dogzip $FLAVOR.flavor
    1.68  		rm $(echo -e $FILES)
    1.69  		status
    1.70  
    1.71 @@ -1991,7 +1996,7 @@
    1.72  				[ -d "$storage/$i" ] && cp -a "$storage/$i" "$tmp_dir"
    1.73  				[ -n "$(ls $tmp_dir/$i)" ] &&
    1.74  					(cd "$tmp_dir/$i"; find . | cpio -o -H newc 2>/dev/null ) | \
    1.75 -					gzip -9 > "$tmp_dir/$flavor.$i"
    1.76 +					dogzip "$tmp_dir/$flavor.$i"
    1.77  				rm -rf "$tmp_dir/$i"
    1.78  			done
    1.79  		else
    1.80 @@ -1999,7 +2004,7 @@
    1.81  			for i in rootcd rootfs; do
    1.82  				[ -d "$storage/$i" ] || continue
    1.83  				(cd  "$storage/$i";
    1.84 -					find . | cpio -o -H newc 2>/dev/null) | gzip -9 > "$tmp_dir/$flavor.$i"
    1.85 +					find . | cpio -o -H newc 2>/dev/null) | dogzip "$tmp_dir/$flavor.$i"
    1.86  			done
    1.87  		fi
    1.88  
    1.89 @@ -2130,14 +2135,14 @@
    1.90  					for i in rootfs rootcd ; do
    1.91  						[ -s $TMP_DIR/flavor/*.list$i ] &&
    1.92  						sed 's/.\{1,45\}//;/^\.$/d' $TMP_DIR/flavor/*.list$i | \
    1.93 -							( cd $TMP_DIR/$i ; cpio -o -H newc ) | gzip -9 > $TMP_DIR/$FLAVOR.$i
    1.94 +							( cd $TMP_DIR/$i ; cpio -o -H newc ) | dogzip $TMP_DIR/$FLAVOR.$i
    1.95  					done
    1.96  				else
    1.97  					find_flavor_rootfs $TMP_DIR/rootfs
    1.98  					[ -d $TMP_DIR/rootfs/boot ] && mv $TMP_DIR/rootfs/boot $TMP_DIR/rootcd
    1.99  					for i in rootfs rootcd ; do
   1.100  						[ "$(ls $TMP_DIR/$i)" ] &&
   1.101 -						( cd "$TMP_DIR/$i"; find * | cpio -o -H newc ) | gzip -9 > "$TMP_DIR/$FLAVOR.$i"
   1.102 +						( cd "$TMP_DIR/$i"; find * | cpio -o -H newc ) | dogzip "$TMP_DIR/$FLAVOR.$i"
   1.103  					done
   1.104  					unset VERSION MAINTAINER
   1.105  					echo -en "Flavor short description \007: "; read -t 30 DESCRIPTION
   1.106 @@ -2167,7 +2172,7 @@
   1.107  Check /home/slitaz/flavors/$(cat /etc/slitaz-release)/$FLAVOR/receipt too and \
   1.108  repack the flavor (tazlito pack-flavor $FLAVOR)"
   1.109  				fi
   1.110 -				( cd $TMP_DIR; ls $FLAVOR.* | cpio -o -H newc ) | gzip -9 > $FLAVOR.flavor
   1.111 +				( cd $TMP_DIR; ls $FLAVOR.* | cpio -o -H newc ) | dogzip $FLAVOR.flavor
   1.112  			fi
   1.113  		fi
   1.114  		rm -rf $TMP_DIR