tazusb rev 185
writefs: use tazlito-writeiso code to create list of files
author | Xander Ziiryanoff <psychomaniak@xakep.ru> |
---|---|
date | Fri Feb 19 16:07:14 2016 +0200 (2016-02-19) |
parents | bce29264a97b |
children | 22d3ffdc6ab6 |
files | tazusb |
line diff
1.1 --- a/tazusb Wed Feb 17 09:32:54 2016 +0100 1.2 +++ b/tazusb Fri Feb 19 16:07:14 2016 +0200 1.3 @@ -9,7 +9,7 @@ 1.4 # Authors: see AUTHORS file 1.5 # 1.6 1.7 -VERSION=4.2.6 1.8 +VERSION=182 1.9 1.10 . /lib/libtaz.sh 1.11 1.12 @@ -39,7 +39,7 @@ 1.13 optlist "\ 1.14 usage $(_ 'Print this short usage.') 1.15 writefs $(_ 'Write the current filesystem to rootfs.gz. Supported compression: lzma, gzip, none.') 1.16 -format $(_ 'Format and label device with ext4, ext3, ext2 or fat32 filesystem (for LiveUSB or /home). Default is ext3.') 1.17 +format $(_ 'Format and label device with ext3, ext2 or fat32 filesystem (for LiveUSB or /home). Default is ext3.') 1.18 gen-liveusb $(_ 'Generate a bootable LiveUSB using files from the LiveCD.') 1.19 gen-swap $(_ 'Create or recreate and activate additional swap memory.') 1.20 gen-iso2usb $(_ 'Generate a bootable LiveUSB using files from ISO file.') 1.21 @@ -111,10 +111,22 @@ 1.22 } 1.23 1.24 1.25 +# Format target device and label partition. 1.26 + 1.27 +mkfs_ext3() { 1.28 + get_label 1.29 + 1.30 + _ 'Label: %s' "$label" 1.31 + echo "Mkfs: mkfs.ext3 -L \"$label\" $DEVICE" 1.32 + newline; sleep 2 1.33 + mkfs.ext3 -L "$label" $DEVICE 1.34 +} 1.35 + 1.36 + 1.37 # Get fs type. Supported fs are ext3, ext2, fat32 1.38 1.39 get_fs_type() { 1.40 - _n 'Please specify a filesystem type ext2, ext3, ext4 or fat32 (ext3): ' 1.41 + _n 'Please specify a filesystem type ext2, ext3 or fat32 (ext3): ' 1.42 read fs_type 1.43 [ -z "$fs_type" ] && fs_type='ext3' 1.44 } 1.45 @@ -124,7 +136,7 @@ 1.46 1.47 ask_for_fs_type() { 1.48 _ 'Please specify the filesystem type to %s.' "$COMMAND" 1.49 - _ 'Available formats are ext4, ext3(default), ext2 or fat32.' 1.50 + _ 'Available formats are ext3(default), ext2 or fat32.' 1.51 _ 'Press enter to keep the default value.' 1.52 newline 1.53 _n 'File system type: '; read answer 1.54 @@ -136,15 +148,15 @@ 1.55 } 1.56 1.57 1.58 -# Format target device in ext4, ext3, ext2 or fat32. 1.59 -# Usage: make_fs ext2|ext4|fat32|ext3 (default) 1.60 +# Format target device in ext3, ext2 or fat32. 1.61 +# Usage: make_fs ext2|fat32|ext3 (default) 1.62 1.63 make_fs() { 1.64 local answer 1.65 1.66 FS=$(echo $fs_type | tr '[A-Z]' '[a-z]') 1.67 case "$FS" in 1.68 - ext4|ext3|ext2) 1.69 + ext3|ext2) 1.70 newline; _ 'Processing...' 1.71 _ 'Label: %s' "$label" 1.72 echo "Mkfs: mkfs.$FS -L \"$label\" $DEVICE" 1.73 @@ -306,10 +318,10 @@ 1.74 sed -i -e "s/\(root=.*\)/\1 home=$UUID/" $(grep -l append $TARGET_ROOT/boot/$ST/*) 1.75 1.76 # Splash screen and help files. 1.77 - cp /media/cdrom/boot/isolinux/splash.* $TARGET_ROOT/boot/$ST 1.78 - cp /media/cdrom/boot/isolinux/*.cfg $TARGET_ROOT/boot/$ST 1.79 - cp /media/cdrom/boot/isolinux/*.kbd $TARGET_ROOT/boot/$ST 1.80 - cp /media/cdrom/boot/isolinux/*.c32 $TARGET_ROOT/boot/$ST 1.81 + cp /media/cdrom/boot/isolinux/splash.* $TARGET_ROOT/boot/$ST 1.82 + cp /media/cdrom/boot/isolinux/*.cfg $TARGET_ROOT/boot/$ST 1.83 + cp /media/cdrom/boot/isolinux/*.kbd $TARGET_ROOT/boot/$ST 1.84 + cp /media/cdrom/boot/isolinux/*.c32 $TARGET_ROOT/boot/$ST 1.85 sed -i -e s/'SliTaz GNU\/Linux'/'SliTaz GNU\/Linux LiveUSB'/ \ 1.86 -e "s/isolinux/$ST/" $TARGET_ROOT/boot/$ST/$ST.$STE 1.87 } 1.88 @@ -342,9 +354,8 @@ 1.89 umount $TARGET_ROOT 2>/dev/null 1.90 _n 'Setting %s as bootable...' "$DEVICE" 1.91 fdisk $DISK >/dev/null << EOF 1.92 -$(fdisk -l $DISK | grep $DISK | sed "/\\*/!ds#$DISK##;s# .*##;s#.*#&\na#") 1.93 a 1.94 -${DEVICE#$DISK} 1.95 +1 1.96 w 1.97 EOF 1.98 status 1.99 @@ -483,7 +494,10 @@ 1.100 # echo /dev/$dev >>/tmp/list 1.101 # done 1.102 1.103 - find /bin /etc /init /sbin /var /dev /lib /root /usr /opt >/tmp/list 1.104 + for dir in /bin /etc /init /sbin /var /dev /lib /root /usr /opt 1.105 + do 1.106 + [ -d $dir -o -f $dir ] && find $dir 1.107 + done >/tmp/list 1.108 1.109 for dir in /home /proc /run /sys /tmp /mnt /media /media/cdrom /media/flash /media/usbdisk 1.110 do 1.111 @@ -491,7 +505,7 @@ 1.112 done 1.113 sed -i '/^\/var\/run\/.*pid$/d' /tmp/list 1.114 1.115 - for removelog in auth boot messages dmesg daemon utmp slim Xorg ; do 1.116 + for removelog in auth boot messages dmesg daemon utmp slim Xorg tazpanel cups; do 1.117 sed -i "\/var\/log\/$removelog/d" /tmp/list 1.118 done 1.119 1.120 @@ -504,8 +518,9 @@ 1.121 gzip) 1.122 _n 'Creating %s with gzip compression... ' "$ROOTFS" 1.123 cpio -o -H newc | gzip -9 > "$ROOTFS_PATH" 1.124 + [ -x /usr/bin/advdef ] && advdef -z4 "$ROOTFS_PATH" 1.125 ;; 1.126 - *) 1.127 + none|*) 1.128 _n 'Creating %s without compression... ' "$ROOTFS" 1.129 cpio -o -H newc > "$ROOTFS_PATH" 1.130 ;; 1.131 @@ -558,6 +573,7 @@ 1.132 get_label 1.133 unmount_target_usb 1.134 make_fs "$fs_type" 1.135 + # mkfs_ext3 1.136 separator 1.137 longline "$(_ 'Device %s is ready to use as LiveUSB and/or /home partition.' "$label ($DEVICE)")" 1.138 ;;