slitaz-boot-scripts rev 158

rcS: get all earlier boot option at one time + home= wait for kernel usb delay
author Christophe Lincoln <pankso@slitaz.org>
date Sun Apr 26 15:13:25 2009 +0200 (2009-04-26)
parents 3ff9c5179331
children 9bde17542c66
files etc/init.d/bootopts.sh etc/init.d/rcS
line diff
     1.1 --- a/etc/init.d/bootopts.sh	Sun Apr 26 14:10:28 2009 +0200
     1.2 +++ b/etc/init.d/bootopts.sh	Sun Apr 26 15:13:25 2009 +0200
     1.3 @@ -33,8 +33,10 @@
     1.4  mount_home()
     1.5  {
     1.6  	echo "Home has been specified to $DEVICE..."
     1.7 -	echo "Sleeping 10 s to let the kernel detect the device... "
     1.8 -	sleep 10
     1.9 +	USBDELAY=`cat /sys/module/usb_storage/parameters/delay_use`
    1.10 +	USBDELAY=$((1+$USBDELAY))
    1.11 +	echo "Sleeping $USBDELAY s to let the kernel detect the device... "
    1.12 +	sleep $USBDELAY
    1.13  	USER=`cat /etc/passwd | grep 1000 | cut -d ":" -f 1`
    1.14  	DEVID=$DEVICE
    1.15  	if [ -x /sbin/blkid ]; then
     2.1 --- a/etc/init.d/rcS	Sun Apr 26 14:10:28 2009 +0200
     2.2 +++ b/etc/init.d/rcS	Sun Apr 26 15:13:25 2009 +0200
     2.3 @@ -8,6 +8,24 @@
     2.4  . /etc/init.d/rc.functions
     2.5  . /etc/rcS.conf
     2.6  
     2.7 +# Parse cmdline args for earlier boot options. All other boot options
     2.8 +# are in /etc/init./bootopts.sh.
     2.9 +for opt in `cat cmdline`
    2.10 +do
    2.11 +	case $opt in
    2.12 +		*fastbootx*|*fbx*)
    2.13 +			FAST_BOOT_X="yes" ;;
    2.14 +		*cdrom=*)
    2.15 +			CDROM=${opt#cdrom=} ;;
    2.16 +		*modprobe=*)
    2.17 +			MODPROBE="yes" ;;
    2.18 +		*config=*)
    2.19 +			CONFIG=${opt#config=} ;;
    2.20 +		*)
    2.21 +			continue ;;
    2.22 +	esac
    2.23 +done
    2.24 +
    2.25  if [ "$1" != "logged" ]; then # logged
    2.26  
    2.27  echo "Processing /etc/init.d/rcS... "
    2.28 @@ -80,7 +98,7 @@
    2.29  # keymap settings since Xvesa dump the console mapping and a correct
    2.30  # slim configuration for screen resolution. DBUS and HAL must also start
    2.31  # befor X session (manual login or autologin) to have devices in PCmanFM.
    2.32 -if [ "$FAST_BOOT_X" = "yes" ] || grep -q -w "fastbootx" /proc/cmdline; then
    2.33 +if [ "$FAST_BOOT_X" = "yes" ]; then
    2.34  	/etc/init.d/i18n.sh
    2.35  	/etc/init.d/dbus start
    2.36  	/etc/init.d/hald start
    2.37 @@ -89,8 +107,8 @@
    2.38  
    2.39  # Create /dev/cdrom if needed (symlink does not exist on LiveCD).
    2.40  # Also add /dev/cdrom to fstab if entry does not exist.
    2.41 -if grep -q " cdrom=" /proc/cmdline; then
    2.42 -	DRIVE_NAME=`cat /proc/cmdline | sed 's/.* cdrom=\([^ ]*\).*/\1/'`
    2.43 +if [ -n "$CDROM" ]; then
    2.44 +	DRIVE_NAME=${CDROM#/dev/}
    2.45  else
    2.46  	DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3`
    2.47  fi
    2.48 @@ -117,7 +135,7 @@
    2.49  fi
    2.50  
    2.51  # Handle kernel cmdline parameter modprobe=<module_list> 
    2.52 -if grep -q " modprobe=" /proc/cmdline; then
    2.53 +if [ -n "$MODPROBE" ]; then
    2.54  	MODULES=`sed -e 's/.* modprobe=\([^ ]*\).*/\1/' -e 's/,/\n/g' < /proc/cmdline`
    2.55  	for i in $MODULES; do
    2.56  		echo -n "Loading kernel module $i"
    2.57 @@ -128,8 +146,7 @@
    2.58  
    2.59  # Handle kernel cmdline parameter config=<device>,<path> to source a 
    2.60  # disk init script
    2.61 -if grep -q " config=" /proc/cmdline; then
    2.62 -	CONFIG=`cat /proc/cmdline | sed 's/.* config=\([^ ]*\).*/\1/'`
    2.63 +if [ -n "$CONFIG" ]; then
    2.64  	DEVICE=${CONFIG%,*}
    2.65  	SCRIPT=${CONFIG#*,}
    2.66  	echo "Probing $DEVICE... "