# HG changeset patch # User Pascal Bellard # Date 1332496087 -3600 # Node ID 0f3d63ac97668a380ee528efe64e8f1967006c76 # Parent 244e4aba431e2d2deb718dc17b6db462beafb366 bootopts.sh: look for usb key device diff -r 244e4aba431e -r 0f3d63ac9766 etc/init.d/bootopts.sh --- a/etc/init.d/bootopts.sh Fri Mar 23 10:39:05 2012 +0100 +++ b/etc/init.d/bootopts.sh Fri Mar 23 10:48:07 2012 +0100 @@ -13,6 +13,16 @@ EOT } +# Get first usb disk +usb_device() +{ + cd /sys/block + for i in sd* sda ; do + grep -q 1 $i/removable && break + done + echo $i +} + # Default user account without password (uid=1000). In live mode the option # user=name can be used, but user must be added before home= to have home dir. # This option is not handled by a loop and case like others and has no @@ -72,7 +82,7 @@ # user home dir. Note: home=usb is a shorter and easier way to # have home=/dev/sda1. DEVICE=${opt#home=} - [ "$DEVICE" = "usb" ] && DEVICE=sda1 + [ "$DEVICE" = "usb" ] && DEVICE="$(usb_device)1" echo "Home has been specified to $DEVICE..." DEVID=`/sbin/blkid | sed 'p;s/"//g' | fgrep "$DEVICE" | sed 's/:.*//;q'` if [ -z "$DEVID" ]; then