slitaz-boot-scripts rev 229
bootopts.sh: try to shortcut USBDELAY
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Feb 05 19:20:24 2011 +0100 (2011-02-05) |
parents | fcdf41a689c8 |
children | be7c1a2e97d7 |
files | etc/init.d/bootopts.sh |
line diff
1.1 --- a/etc/init.d/bootopts.sh Sat Feb 05 19:02:40 2011 +0100 1.2 +++ b/etc/init.d/bootopts.sh Sat Feb 05 19:20:24 2011 +0100 1.3 @@ -92,17 +92,20 @@ 1.4 DEVICE=${opt#home=} 1.5 [ "$DEVICE" = "usb" ] && DEVICE=sda1 1.6 echo "Home has been specified to $DEVICE..." 1.7 - USBDELAY=`cat /sys/module/usb_storage/parameters/delay_use` 1.8 - USBDELAY=$((2+$USBDELAY)) 1.9 - echo "Sleeping $USBDELAY s to let the kernel detect the device... " 1.10 - sleep $USBDELAY 1.11 + DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'` 1.12 + if [ -z "$DEVID" ]; then 1.13 + USBDELAY=`cat /sys/module/usb_storage/parameters/delay_use` 1.14 + USBDELAY=$((2+$USBDELAY)) 1.15 + echo "Sleeping $USBDELAY s to let the kernel detect the device... " 1.16 + sleep $USBDELAY 1.17 + fi 1.18 USER=`cat /etc/passwd | sed '/:1000:/!d;s/:.*//;q'` 1.19 DEVID=$DEVICE 1.20 if [ -x /sbin/blkid ]; then 1.21 # Can be a label, uuid, type or devname. DEVID gives us first: /dev/name. 1.22 DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'` 1.23 - DEVID=${DEVID##*/} 1.24 fi 1.25 + DEVID=${DEVID##*/} 1.26 if [ -n "$DEVID" ] && grep -q "$DEVID" /proc/partitions ; then 1.27 echo "Mounting /home on /dev/$DEVID... " 1.28 [ -d /home/$USER ] && mv /home/$USER /tmp/$USER-files