tazlito rev 150

Back to rev 147
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jan 24 21:13:29 2010 +0100 (2010-01-24)
parents 5e7f3f9bf5d7
children 815f49f80af4
files tazlito
line diff
     1.1 --- a/tazlito	Sun Jan 24 21:04:23 2010 +0100
     1.2 +++ b/tazlito	Sun Jan 24 21:13:29 2010 +0100
     1.3 @@ -311,7 +311,7 @@
     1.4  {
     1.5  	( cd $1 ; find . -print | cpio -o -H newc ) | \
     1.6  	if [ "$COMPRESSION" = "none" ]; then
     1.7 -		echo -n "Generating uncompressed initramfs... "
     1.8 +		echo "Generating uncompressed initramfs... "
     1.9  		cat > $2
    1.10  	elif [ -x /usr/bin/lzma -a "$COMPRESSION" != "gzip" ]; then
    1.11  		echo -n "Generating lzma'ed initramfs... "
    1.12 @@ -320,6 +320,23 @@
    1.13  		echo -n "Generating gziped initramfs... "
    1.14  		gzip -9 > $2
    1.15  	fi
    1.16 +	echo 1 > /tmp/rootfs
    1.17 +}
    1.18 +
    1.19 +# Compression functions for writeiso.
    1.20 +write_initramfs()
    1.21 +{
    1.22 +	if [ "$COMPRESSION" = "lzma" ]; then
    1.23 +		echo -n "Creating rootfs.gz with lzma compression... "
    1.24 +		cat /tmp/list | cpio -o -H newc | lzma e -si -so > /rootfs.gz
    1.25 +	elif [ "$COMPRESSION" = "gzip" ]; then
    1.26 +		echo "Creating rootfs.gz with gzip compression... "
    1.27 +		cat /tmp/list | cpio -o -H newc | gzip -9 > /rootfs.gz
    1.28 +	else
    1.29 +		echo "Creating rootfs.gz without compression... "
    1.30 +		cat /tmp/list | cpio -o -H newc > /rootfs.gz
    1.31 +	fi
    1.32 +	echo 1 > /tmp/rootfs
    1.33  }
    1.34  
    1.35  # Generate a new initramfs from the root filesystem.
    1.36 @@ -349,32 +366,21 @@
    1.37             echo "$save bytes saved in duplicate files."
    1.38          )
    1.39  
    1.40 -	# Use lzma if installed
    1.41 -	pack_rootfs . $DISTRO/$(basename $1).gz
    1.42 +	# Use lzma if installed. Display rootfs size in realtime.
    1.43 +	rm -f /tmp/rootfs
    1.44 +	pack_rootfs . $DISTRO/$(basename $1).gz &
    1.45 +	sleep 2
    1.46 +	echo -en "\nFilesystem size:"
    1.47 +	while [ ! -f /tmp/rootfs ]
    1.48 +	do
    1.49 +		sleep 1
    1.50 +		echo -en "\\033[18G`du -sh $DISTRO/rootfs.gz | awk '{print $1}'`    "
    1.51 +	done
    1.52 +	echo -e "\n"
    1.53  	cd $DISTRO
    1.54  	mv $(basename $1).gz $ROOTCD/boot
    1.55  }
    1.56  
    1.57 -# Compression functions for writeiso.
    1.58 -write_lzma_initramfs()
    1.59 -{
    1.60 -	echo -n "Creating rootfs.gz with lzma compression... "
    1.61 -	cat /tmp/list | cpio -o -H newc | lzma e -si -so > /rootfs.gz
    1.62 -	echo 1 > /tmp/rootfs
    1.63 -}
    1.64 -write_gzip_initramfs()
    1.65 -{
    1.66 -	echo "Creating rootfs.gz with gzip compression... "
    1.67 -	cat /tmp/list | cpio -o -H newc | gzip -9 > /rootfs.gz
    1.68 -	echo 1 > /tmp/rootfs
    1.69 -}
    1.70 -write_initramfs()
    1.71 -{
    1.72 -	echo "Creating rootfs.gz without compression... "
    1.73 -	cat /tmp/list | cpio -o -H newc > /rootfs.gz
    1.74 -	echo 1 > /tmp/rootfs
    1.75 -}
    1.76 -
    1.77  distro_sizes()
    1.78  {
    1.79  	echo "Build date      : `date +%Y%m%d\ \at\ \%H:%M:%S`"
    1.80 @@ -1132,7 +1138,6 @@
    1.81  					mkdir -p "$ADDFILES/$i"
    1.82  					zcat $TMP_DIR/$FLAVOR.$i | \
    1.83  						( cd "$ADDFILES/$i"; cpio -id 2> /dev/null)
    1.84 -					status
    1.85  				fi
    1.86  			done
    1.87  			if [ -s $TMP_DIR/$FLAVOR.mirrors ]; then
    1.88 @@ -1523,20 +1528,20 @@
    1.89  		rm -rf /home/slitaz/distro
    1.90  
    1.91  		# Optionally remove sound card selection and screen resolution.
    1.92 -		echo "Do you wish to remove the sound card and screen configs ? "
    1.93 -		echo -n "Press ENTER to keep or answer (No|yes|exit): "
    1.94 +		echo "Do you wish to remove the sound card and screen config ? "
    1.95 +		echo -n "Press ENTER to keep or anser (No|yes|exit): "
    1.96  		read anser
    1.97  		case $anser in
    1.98  			e|E|"exit"|Exit)
    1.99  				exit 0 ;;
   1.100  			y|Y|yes|Yes)
   1.101 -				echo -n "Removing current sound card and screen configurations..."
   1.102 +				echo -n "Removing current sound card and screen configuration..."
   1.103  				rm -f /var/lib/sound-card-driver
   1.104  				rm -f /etc/asound.state
   1.105  				rm -f /etc/X11/screen.conf 
   1.106  				rm -f /etc/X11/xorg.conf ;;
   1.107  			*)
   1.108 -				echo -n "Keeping current sound card and screen configurations..." ;;
   1.109 +				echo -n "Keeping current sound card and screen configuration..." ;;
   1.110  		esac
   1.111  		status
   1.112  		
   1.113 @@ -1548,17 +1553,11 @@
   1.114  		do
   1.115  			echo $dir >>/tmp/list
   1.116  		done
   1.117 +
   1.118 +		# Generate initramfs with specified compression and display rootf
   1.119 +		# size in realtime.
   1.120  		rm -f /tmp/rootfs
   1.121 -
   1.122 -		# Generate initramfs with specified compression and display rootfs
   1.123 -		# size in realtime.
   1.124 -		if [ "$COMPRESSION" = "lzma" ]; then
   1.125 -			write_lzma_initramfs &
   1.126 -		elif [ "$COMPRESSION" = "gzip" ]; then
   1.127 -			write_gzip_initramfs &
   1.128 -		else
   1.129 -			write_initramfs &
   1.130 -		fi
   1.131 +		write_initramfs &
   1.132  		sleep 2
   1.133  		echo -en "\nFilesystem size:"
   1.134  		while [ ! -f /tmp/rootfs ]
   1.135 @@ -1580,9 +1579,8 @@
   1.136  		else
   1.137  			echo -e "
   1.138  Unable to mount the cdrom to copy the Kernel and needed files. When SliTaz
   1.139 -is running in RAM the kernel and bootloader files are kept on the cdrom.
   1.140 -Please insert a LiveCD or unmount the current cdrom to let Tazlito handle 
   1.141 -the media.\n"
   1.142 +is running in RAM the kernel and bootloader files are keeped on the cdrom.
   1.143 +Please insert a LiveCD or unmount curent cdrom to let Tazlito handle the media.\n"
   1.144  			echo -en "----\nENTER to continue..."; read i
   1.145  			exit 1
   1.146  		fi