tazusb rev 9

Added back support for device partitions
author Andrew Miller <spode@thinkbikes.com>
date Wed Mar 12 21:26:43 2008 +0000 (2008-03-12)
parents 132de4a8e0af
children 302a38794977
files tazusb
line diff
     1.1 --- a/tazusb	Wed Mar 12 17:03:10 2008 +0000
     1.2 +++ b/tazusb	Wed Mar 12 21:26:43 2008 +0000
     1.3 @@ -58,20 +58,19 @@
     1.4  # Verify a device exists before format or install
     1.5  check_for_device()
     1.6  {
     1.7 -	DEVID=`fdisk -l | grep -m 1 -w $DEVICE | cut -d: -f1 | cut -d/ -f3`
     1.8 -	if [ -z "$DEVID" ]; then
     1.9 +	IFDEV=`fdisk -l | grep $DEVICE`
    1.10 +	if [ -z "$IFDEV" ]; then
    1.11  		echo -e "\nUnable to find device: $DEVICE\n"
    1.12  		exit 0
    1.13  	fi
    1.14 -	
    1.15 -	PARTID=/dev/"$DEVID"1
    1.16 +	DEVID=${DEVID%?}
    1.17  }
    1.18  
    1.19  #gets the UUID and filesystem type
    1.20  get_part_info()
    1.21  {
    1.22 -	UUID=`blkid -s UUID -o value $PARTID`
    1.23 -	FSTYPE=`blkid -s TYPE -o value $PARTID`
    1.24 +	UUID=`blkid -s UUID -o value $DEVICE`
    1.25 +	FSTYPE=`blkid -s TYPE -o value $DEVICE`
    1.26  }
    1.27  
    1.28  # Format target device and label partition.
    1.29 @@ -85,9 +84,9 @@
    1.30  	fi
    1.31  	
    1.32  	echo "Label  : $label"
    1.33 -	echo "Mkfs   : mkfs.ext3 -L \"$label\" $PARTID"
    1.34 +	echo "Mkfs   : mkfs.ext3 -L \"$label\" $DEVICE"
    1.35  	echo "" && sleep 2
    1.36 -	mkfs.ext3 -L "$label" $PARTID
    1.37 +	mkfs.ext3 -L "$label" $DEVICE
    1.38  	
    1.39  }
    1.40  
    1.41 @@ -100,9 +99,9 @@
    1.42  	fi
    1.43  	
    1.44  	# Device could be mounted elsewhere, so unmount
    1.45 -	if mount | grep $PARTID; then
    1.46 +	if mount | grep $DEVICE; then
    1.47  		echo "Unmounting USB target device..."
    1.48 -		umount $PARTID
    1.49 +		umount $DEVICE
    1.50  	fi
    1.51  }
    1.52  
    1.53 @@ -111,7 +110,7 @@
    1.54  {
    1.55  	echo "Mounting USB target device..."	
    1.56  	mkdir -p $TARGET_ROOT
    1.57 -	mount $PARTID $TARGET_ROOT 2>/dev/null
    1.58 +	mount $DEVICE $TARGET_ROOT 2>/dev/null
    1.59  }
    1.60  
    1.61  # Mount SliTaz LiveCD to get needed files.
    1.62 @@ -147,11 +146,11 @@
    1.63  	# MBR
    1.64  	if [ -f /usr/share/syslinux/mbr.bin ]; then
    1.65  		echo -n "Installing a new MBR to: $DEVICE"
    1.66 -		cat /usr/share/syslinux/mbr.bin > $DEVICE
    1.67 +		cat /usr/share/syslinux/mbr.bin > $DEVID
    1.68  		status
    1.69  	else
    1.70  		# Skip MBR install (tazpkg get-install syslinux-extra ? and then cat)
    1.71 -		echo "No new MBR installed to: $DEVICE"
    1.72 +		echo "No new MBR installed to: $DEVID"
    1.73  	fi
    1.74  }
    1.75  
    1.76 @@ -161,7 +160,7 @@
    1.77  	#decide if we're installing syslinux or extlinux
    1.78  	if [ "$FSTYPE" = "vfat" ]; then
    1.79  		ST=syslinux
    1.80 -		STC="syslinux -d /boot/syslinux/ $PARTID"
    1.81 +		STC="syslinux -d /boot/syslinux/ $DEVICE"
    1.82  		STE=cfg
    1.83  	else
    1.84  		ST=extlinux
    1.85 @@ -232,7 +231,7 @@
    1.86  	# If not set, set bootable
    1.87  	if [ -z "$ISSET" ]; then
    1.88  	umount $DEVICE
    1.89 -	echo "Setting $PARTID as bootable..."
    1.90 +	echo "Setting $DEVICE as bootable..."
    1.91  	fdisk $DEVICE >/dev/null << EOF
    1.92  a
    1.93  1
    1.94 @@ -346,7 +345,7 @@
    1.95  		echo "Device : $DEVICE"
    1.96  		mkfs_ext3
    1.97  		echo "==============================================================================="
    1.98 -		echo "Device $label ($PARTID) is ready to use as LiveUSB and/or /home partition."
    1.99 +		echo "Device $label ($DEVICE) is ready to use as LiveUSB and/or /home partition."
   1.100  		echo ""
   1.101  		;;
   1.102  	gen-liveusb)