slitaz-boot-scripts rev 228

bootopts.sh: support for both 'root=LABEL=string' and 'root=LABEL="string"'
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 05 19:02:40 2011 +0100 (2011-02-05)
parents 1b8bc5eabf59
children f12a7bdb3980
files etc/init.d/bootopts.sh
line diff
     1.1 --- a/etc/init.d/bootopts.sh	Wed Feb 02 00:03:01 2011 +0100
     1.2 +++ b/etc/init.d/bootopts.sh	Sat Feb 05 19:02:40 2011 +0100
     1.3 @@ -96,11 +96,11 @@
     1.4  			USBDELAY=$((2+$USBDELAY))
     1.5  			echo "Sleeping $USBDELAY s to let the kernel detect the device... "
     1.6  			sleep $USBDELAY
     1.7 -			USER=`cat /etc/passwd | grep 1000 | cut -d ":" -f 1`
     1.8 +			USER=`cat /etc/passwd | sed '/:1000:/!d;s/:.*//;q'`
     1.9  			DEVID=$DEVICE
    1.10  			if [ -x /sbin/blkid ]; then
    1.11 -				# Can be a label, uuid or devname. DEVID gives us first: /dev/name.
    1.12 -				DEVID=`/sbin/blkid | grep $DEVICE | cut -d: -f1`
    1.13 +				# Can be a label, uuid, type or devname. DEVID gives us first: /dev/name.
    1.14 +				DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'`
    1.15  				DEVID=${DEVID##*/}
    1.16  			fi
    1.17  			if [ -n "$DEVID" ] && grep -q "$DEVID" /proc/partitions ; then
    1.18 @@ -111,7 +111,7 @@
    1.19  				# Check if swap file must be generated in /home: swap=size (Mb).
    1.20  				# This option is only used within home=device.
    1.21  				if grep -q "swap=[1-9]*" /proc/cmdline; then
    1.22 -					SWAP_SIZE=`cat /proc/cmdline | sed 's/.*swap=\([^ ]*\).*/\1/'`
    1.23 +					SWAP_SIZE=`sed 's/.*swap=\([^ ]*\).*/\1/' < /proc/cmdline`
    1.24  					# DD to gen a virtual disk.
    1.25  					echo "Generating swap file: /home/swap ($SWAP_SIZE)..."
    1.26  					dd if=/dev/zero of=/home/swap bs=1M count=$SWAP_SIZE
    1.27 @@ -158,7 +158,7 @@
    1.28  		mount)
    1.29  			# Mount all ext3 partitions found (opt: mount).
    1.30  			# Get the list of partitions.
    1.31 -			DEVICES_LIST=`fdisk -l | grep 83 | cut -d " " -f 1`
    1.32 +			DEVICES_LIST=`fdisk -l | sed '/83 Linux/!d;s/ .*//'`
    1.33  			# Mount filesystems rw.
    1.34  			for device in $DEVICES_LIST
    1.35  			do
    1.36 @@ -208,7 +208,7 @@
    1.37  
    1.38  # Activate an eventual swap file or partition.
    1.39  if [ "`fdisk -l | grep swap`" ]; then
    1.40 -	for SWAP_DEV in `fdisk -l | grep swap | awk '{ print $1 }'`; do
    1.41 +	for SWAP_DEV in `fdisk -l | sed '/swap/!d;s/ .*//'`; do
    1.42  		echo "Swap memory detected on: $SWAP_DEV"
    1.43  		add_swap_in_fstab $SWAP_DEV
    1.44  	done