#!/bin/sh # # Archfs - entirely copied from part of the Tazusb utility supplied with # SLiTaz GNU Linux - with some cosmetic changes. # # ### Tazusb - SliTaz LiveUSB ### ### Tazusb is an utility to generate, configure and manipulate SliTaz LiveUSB ### bootable media and/or USB /home partition, such as flash keys, SD card or ### USB harddisk. ### ### Authors : Christophe Lincoln (Pankso) ### Andrew Miller (Spode) # COMMAND=$1 case $COMMAND in writefs) # Writefs to rootfs.gz if [ -z $2 ]; then COMPRESSION=none else COMPRESSION=$2 fi # Start info echo "" echo -e "\033[1mWrite filesystem\033[0m =============================================================================== The command writefs will write all the current filesystem into a suitable cpio archive (rootfs.gz) usable on a bootable LiveUSB media. Archive compression: $COMPRESSION" echo "" # Create list of files find /bin /etc /init /sbin /var /lib /lib64 /root /usr >/tmp/list for dir in /boot /dev /home /proc /sys /tmp /mnt /media /run do echo $dir >>/tmp/list done # Generate initramfs with specified compression if [ "$COMPRESSION" = "lzma" ]; then echo -n "Creating archfs.gz with lzma compression... " cat /tmp/list | cpio -o -H newc | lzma > /archfs.gz elif [ "$COMPRESSION" = "gzip" ]; then echo -n "Creating archfs.gz with gzip compression... " cat /tmp/list | cpio -o -H newc | gzip -9 > /archfs.gz else echo -n "Creating archfs.gz without compression... " cat /tmp/list | cpio -o -H newc > /archfs.gz fi # Get initramfs size size=`du -sh /archfs.gz | cut -f 1` echo "===============================================================================" echo "Root filesystem size: $size" echo "" echo -en "----\nENTER to continue..."; read i ;; esac exit 0