tazusb rev 205

busybox blkid support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Aug 19 10:56:11 2020 +0000 (2020-08-19)
parents ec96a83b70fc
children ac809a573f3c
files tazusb
line diff
     1.1 --- a/tazusb	Sat Aug 15 11:01:32 2020 +0000
     1.2 +++ b/tazusb	Wed Aug 19 10:56:11 2020 +0000
     1.3 @@ -85,8 +85,7 @@
     1.4  # Verify a device exists before format or install
     1.5  
     1.6  check_for_device() {
     1.7 -	IFDEV="$(fdisk -l | grep $DEVICE)"
     1.8 -	if [ -z "$IFDEV" ]; then
     1.9 +	if [ -z "$(blkid | grep "^$DEVICE:")" ]; then
    1.10  		newline
    1.11  		_ 'Unable to find device %s' "$DEVICE"
    1.12  		exit 0
    1.13 @@ -97,8 +96,8 @@
    1.14  # gets the UUID and filesystem type
    1.15  
    1.16  get_part_info() {
    1.17 -	UUID="$(blkid -s UUID -o value $DEVICE)"
    1.18 -	FSTYPE="$(blkid -s TYPE -o value $DEVICE)"
    1.19 +	UUID="$(blkid $DEVICE | sed 's|.* UUID="||;s|".*||')"
    1.20 +	FSTYPE="$(blkid $DEVICE | sed 's|.* TYPE="||;s|".*||')"
    1.21  }
    1.22  
    1.23  
    1.24 @@ -111,12 +110,15 @@
    1.25  }
    1.26  
    1.27  
    1.28 -# Get fs type. Supported fs are ext3, ext2, fat32
    1.29 +# Get fs type. Supported fs are ext4, ext3, ext2, fat32
    1.30  
    1.31  get_fs_type() {
    1.32  	_n 'Please specify a filesystem type ext2, ext3, ext4 or fat32 (ext3): '
    1.33  	read fs_type
    1.34 -	[ -z "$fs_type" ] && fs_type='ext3'
    1.35 +	case "$fs_type" in
    1.36 +	ext2|ext4|fat32);;
    1.37 +	*) fs_type='ext3'
    1.38 +	esac
    1.39  }
    1.40  
    1.41  
    1.42 @@ -127,12 +129,11 @@
    1.43  	_ 'Available formats are ext4, ext3(default), ext2 or fat32.'
    1.44  	_ 'Press enter to keep the default value.'
    1.45  	newline
    1.46 -	_n 'File system type: '; read answer
    1.47 -	if [ -z "$answer" ]; then
    1.48 -		FS_TYPE='ext3'
    1.49 -	else
    1.50 -		FS_TYPE="$answer"
    1.51 -	fi
    1.52 +	_n 'File system type: '; read FS_TYPE
    1.53 +	case "$FS_TYPE" in
    1.54 +	ext2|ext4|fat32);;
    1.55 +	*) FS_TYPE='ext3'
    1.56 +	esac
    1.57  }
    1.58  
    1.59  
    1.60 @@ -258,8 +259,8 @@
    1.61  	mkdir -p                         $TARGET_ROOT/boot
    1.62  	cp /media/cdrom/boot/bzImage*    $TARGET_ROOT/boot
    1.63  	cp /media/cdrom/boot/rootfs*.gz* $TARGET_ROOT/boot
    1.64 -	cp /media/cdrom/boot/memtest     $TARGET_ROOT/boot 2>/dev/null
    1.65 -	cp /media/cdrom/boot/*pxe        $TARGET_ROOT/boot 2>/dev/null
    1.66 +	cp /media/cdrom/boot/memtest*    $TARGET_ROOT/boot 2>/dev/null
    1.67 +	cp /media/cdrom/boot/*pxe*       $TARGET_ROOT/boot 2>/dev/null
    1.68  	status
    1.69  }
    1.70  
    1.71 @@ -310,6 +311,8 @@
    1.72  	cp /media/cdrom/boot/isolinux/*.cfg	$TARGET_ROOT/boot/$ST
    1.73  	cp /media/cdrom/boot/isolinux/*kbd	$TARGET_ROOT/boot/$ST
    1.74  	cp /media/cdrom/boot/isolinux/*.c32	$TARGET_ROOT/boot/$ST
    1.75 +	cp /media/cdrom/boot/isolinux/opts.*	$TARGET_ROOT/boot/$ST
    1.76 +	cp /media/cdrom/boot/isolinux/help.*	$TARGET_ROOT/boot/$ST
    1.77  	sed -i -e s/'SliTaz GNU\/Linux'/'SliTaz GNU\/Linux LiveUSB'/ \
    1.78  		-e "s/isolinux/$ST/" $TARGET_ROOT/boot/$ST/$ST.$STE
    1.79  }
    1.80 @@ -526,7 +529,7 @@
    1.81  
    1.82  			# Move the old filesystem with the unix timestamp for reference
    1.83  			if [ -e /home/boot/previous.gz ]; then
    1.84 -				mv /home/boot/previous.gz /home/boot/rootfs.gz.$(date +%s)
    1.85 +				mv /home/boot/previous.gz /home/boot/rootfs.gz.$(date -r /home/boot/previous.gz +%s)
    1.86  			fi
    1.87  			
    1.88  			mv /home/boot/rootfs.gz /home/boot/previous.gz