tazlito rev 144
Improve writeiso functions
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sun Jan 24 19:35:18 2010 +0100 (2010-01-24) |
parents | 3482249849cf |
children | 75e41b4cb880 |
files | tazlito |
line diff
1.1 --- a/tazlito Sun Jan 24 19:21:32 2010 +0100 1.2 +++ b/tazlito Sun Jan 24 19:35:18 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 /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 @@ -1545,17 +1551,11 @@ 1.81 do 1.82 echo $dir >>/tmp/list 1.83 done 1.84 - rm -f /tmp/rootfs 1.85 1.86 # Generate initramfs with specified compression and display rootf 1.87 # size in realtime. 1.88 - if [ "$COMPRESSION" = "lzma" ]; then 1.89 - write_lzma_initramfs & 1.90 - elif [ "$COMPRESSION" = "gzip" ]; then 1.91 - write_gzip_initramfs & 1.92 - else 1.93 - write_initramfs & 1.94 - fi 1.95 + rm -f /tmp/rootfs 1.96 + write_initramfs & 1.97 sleep 2 1.98 echo -en "\nFilesystem size:" 1.99 while [ ! -f /tmp/rootfs ]