# HG changeset patch # User Christophe Lincoln # Date 1264358118 -3600 # Node ID 489f1156542e59dc1f0dcc17714c123ca0b27da3 # Parent 3482249849cf0d08f89c42f53d7385ade3e746fa Improve writeiso functions diff -r 3482249849cf -r 489f1156542e tazlito --- a/tazlito Sun Jan 24 19:21:32 2010 +0100 +++ b/tazlito Sun Jan 24 19:35:18 2010 +0100 @@ -311,7 +311,7 @@ { ( cd $1 ; find . -print | cpio -o -H newc ) | \ if [ "$COMPRESSION" = "none" ]; then - echo -n "Generating uncompressed initramfs... " + echo "Generating uncompressed initramfs... " cat > $2 elif [ -x /usr/bin/lzma -a "$COMPRESSION" != "gzip" ]; then echo -n "Generating lzma'ed initramfs... " @@ -320,6 +320,23 @@ echo -n "Generating gziped initramfs... " gzip -9 > $2 fi + echo 1 > /tmp/rootfs +} + +# Compression functions for writeiso. +write_initramfs() +{ + if [ "$COMPRESSION" = "lzma" ]; then + echo -n "Creating rootfs.gz with lzma compression... " + cat /tmp/list | cpio -o -H newc | lzma e -si -so > /rootfs.gz + elif [ "$COMPRESSION" = "gzip" ]; then + echo "Creating rootfs.gz with gzip compression... " + cat /tmp/list | cpio -o -H newc | gzip -9 > /rootfs.gz + else + echo "Creating rootfs.gz without compression... " + cat /tmp/list | cpio -o -H newc > /rootfs.gz + fi + echo 1 > /tmp/rootfs } # Generate a new initramfs from the root filesystem. @@ -349,32 +366,21 @@ echo "$save bytes saved in duplicate files." ) - # Use lzma if installed - pack_rootfs . $DISTRO/$(basename $1).gz + # Use lzma if installed. Display rootfs size in realtime. + rm -f /tmp/rootfs + pack_rootfs . $DISTRO/$(basename $1).gz & + sleep 2 + echo -en "\nFilesystem size:" + while [ ! -f /tmp/rootfs ] + do + sleep 1 + echo -en "\\033[18G`du -sh /rootfs.gz | awk '{print $1}'` " + done + echo -e "\n" cd $DISTRO mv $(basename $1).gz $ROOTCD/boot } -# Compression functions for writeiso. -write_lzma_initramfs() -{ - echo -n "Creating rootfs.gz with lzma compression... " - cat /tmp/list | cpio -o -H newc | lzma e -si -so > /rootfs.gz - echo 1 > /tmp/rootfs -} -write_gzip_initramfs() -{ - echo "Creating rootfs.gz with gzip compression... " - cat /tmp/list | cpio -o -H newc | gzip -9 > /rootfs.gz - echo 1 > /tmp/rootfs -} -write_initramfs() -{ - echo "Creating rootfs.gz without compression... " - cat /tmp/list | cpio -o -H newc > /rootfs.gz - echo 1 > /tmp/rootfs -} - distro_sizes() { echo "Build date : `date +%Y%m%d\ \at\ \%H:%M:%S`" @@ -1545,17 +1551,11 @@ do echo $dir >>/tmp/list done - rm -f /tmp/rootfs # Generate initramfs with specified compression and display rootf # size in realtime. - if [ "$COMPRESSION" = "lzma" ]; then - write_lzma_initramfs & - elif [ "$COMPRESSION" = "gzip" ]; then - write_gzip_initramfs & - else - write_initramfs & - fi + rm -f /tmp/rootfs + write_initramfs & sleep 2 echo -en "\nFilesystem size:" while [ ! -f /tmp/rootfs ]