# HG changeset patch # User Xander Ziiryanoff # Date 1455890834 -7200 # Node ID 1a1165db2fc2f0c63693752c2861dbca749fc73e # Parent bce29264a97b6c1083f42436a8bb0c7b2079a206 writefs: use tazlito-writeiso code to create list of files diff -r bce29264a97b -r 1a1165db2fc2 tazusb --- a/tazusb Wed Feb 17 09:32:54 2016 +0100 +++ b/tazusb Fri Feb 19 16:07:14 2016 +0200 @@ -9,7 +9,7 @@ # Authors: see AUTHORS file # -VERSION=4.2.6 +VERSION=182 . /lib/libtaz.sh @@ -39,7 +39,7 @@ optlist "\ usage $(_ 'Print this short usage.') writefs $(_ 'Write the current filesystem to rootfs.gz. Supported compression: lzma, gzip, none.') -format $(_ 'Format and label device with ext4, ext3, ext2 or fat32 filesystem (for LiveUSB or /home). Default is ext3.') +format $(_ 'Format and label device with ext3, ext2 or fat32 filesystem (for LiveUSB or /home). Default is ext3.') gen-liveusb $(_ 'Generate a bootable LiveUSB using files from the LiveCD.') gen-swap $(_ 'Create or recreate and activate additional swap memory.') gen-iso2usb $(_ 'Generate a bootable LiveUSB using files from ISO file.') @@ -111,10 +111,22 @@ } +# Format target device and label partition. + +mkfs_ext3() { + get_label + + _ 'Label: %s' "$label" + echo "Mkfs: mkfs.ext3 -L \"$label\" $DEVICE" + newline; sleep 2 + mkfs.ext3 -L "$label" $DEVICE +} + + # Get fs type. Supported fs are ext3, ext2, fat32 get_fs_type() { - _n 'Please specify a filesystem type ext2, ext3, ext4 or fat32 (ext3): ' + _n 'Please specify a filesystem type ext2, ext3 or fat32 (ext3): ' read fs_type [ -z "$fs_type" ] && fs_type='ext3' } @@ -124,7 +136,7 @@ ask_for_fs_type() { _ 'Please specify the filesystem type to %s.' "$COMMAND" - _ 'Available formats are ext4, ext3(default), ext2 or fat32.' + _ 'Available formats are ext3(default), ext2 or fat32.' _ 'Press enter to keep the default value.' newline _n 'File system type: '; read answer @@ -136,15 +148,15 @@ } -# Format target device in ext4, ext3, ext2 or fat32. -# Usage: make_fs ext2|ext4|fat32|ext3 (default) +# Format target device in ext3, ext2 or fat32. +# Usage: make_fs ext2|fat32|ext3 (default) make_fs() { local answer FS=$(echo $fs_type | tr '[A-Z]' '[a-z]') case "$FS" in - ext4|ext3|ext2) + ext3|ext2) newline; _ 'Processing...' _ 'Label: %s' "$label" echo "Mkfs: mkfs.$FS -L \"$label\" $DEVICE" @@ -306,10 +318,10 @@ sed -i -e "s/\(root=.*\)/\1 home=$UUID/" $(grep -l append $TARGET_ROOT/boot/$ST/*) # Splash screen and help files. - cp /media/cdrom/boot/isolinux/splash.* $TARGET_ROOT/boot/$ST - cp /media/cdrom/boot/isolinux/*.cfg $TARGET_ROOT/boot/$ST - cp /media/cdrom/boot/isolinux/*.kbd $TARGET_ROOT/boot/$ST - cp /media/cdrom/boot/isolinux/*.c32 $TARGET_ROOT/boot/$ST + cp /media/cdrom/boot/isolinux/splash.* $TARGET_ROOT/boot/$ST + cp /media/cdrom/boot/isolinux/*.cfg $TARGET_ROOT/boot/$ST + cp /media/cdrom/boot/isolinux/*.kbd $TARGET_ROOT/boot/$ST + cp /media/cdrom/boot/isolinux/*.c32 $TARGET_ROOT/boot/$ST sed -i -e s/'SliTaz GNU\/Linux'/'SliTaz GNU\/Linux LiveUSB'/ \ -e "s/isolinux/$ST/" $TARGET_ROOT/boot/$ST/$ST.$STE } @@ -342,9 +354,8 @@ umount $TARGET_ROOT 2>/dev/null _n 'Setting %s as bootable...' "$DEVICE" fdisk $DISK >/dev/null << EOF -$(fdisk -l $DISK | grep $DISK | sed "/\\*/!ds#$DISK##;s# .*##;s#.*#&\na#") a -${DEVICE#$DISK} +1 w EOF status @@ -483,7 +494,10 @@ # echo /dev/$dev >>/tmp/list # done - find /bin /etc /init /sbin /var /dev /lib /root /usr /opt >/tmp/list + for dir in /bin /etc /init /sbin /var /dev /lib /root /usr /opt + do + [ -d $dir -o -f $dir ] && find $dir + done >/tmp/list for dir in /home /proc /run /sys /tmp /mnt /media /media/cdrom /media/flash /media/usbdisk do @@ -491,7 +505,7 @@ done sed -i '/^\/var\/run\/.*pid$/d' /tmp/list - for removelog in auth boot messages dmesg daemon utmp slim Xorg ; do + for removelog in auth boot messages dmesg daemon utmp slim Xorg tazpanel cups; do sed -i "\/var\/log\/$removelog/d" /tmp/list done @@ -504,8 +518,9 @@ gzip) _n 'Creating %s with gzip compression... ' "$ROOTFS" cpio -o -H newc | gzip -9 > "$ROOTFS_PATH" + [ -x /usr/bin/advdef ] && advdef -z4 "$ROOTFS_PATH" ;; - *) + none|*) _n 'Creating %s without compression... ' "$ROOTFS" cpio -o -H newc > "$ROOTFS_PATH" ;; @@ -558,6 +573,7 @@ get_label unmount_target_usb make_fs "$fs_type" + # mkfs_ext3 separator longline "$(_ 'Device %s is ready to use as LiveUSB and/or /home partition.' "$label ($DEVICE)")" ;;