slitaz-boot-scripts rev 283

bootopts.sh: speed up using fgrep in some case
author Christophe Lincoln <pankso@slitaz.org>
date Sat Mar 03 18:36:31 2012 +0100 (2012-03-03)
parents befbf0dc7341
children 11f87b20a969
files etc/init.d/bootopts.sh
line diff
     1.1 --- a/etc/init.d/bootopts.sh	Sat Mar 03 18:14:18 2012 +0100
     1.2 +++ b/etc/init.d/bootopts.sh	Sat Mar 03 18:36:31 2012 +0100
     1.3 @@ -18,7 +18,7 @@
     1.4  # This option is not handled by a loop and case like others and has no
     1.5  # effect on an installed system.
     1.6  if ! grep -q "100[0-9]:100[0-9]" /etc/passwd; then
     1.7 -	if grep -q "user=" /proc/cmdline; then
     1.8 +	if fgrep -q "user=" /proc/cmdline; then
     1.9  		USER=`cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/'`
    1.10  		# Avoid usage of an existing system user or root.
    1.11  		if grep -q ^$USER /etc/passwd; then
    1.12 @@ -74,7 +74,7 @@
    1.13  			DEVICE=${opt#home=}
    1.14  			[ "$DEVICE" = "usb" ] && DEVICE=sda1
    1.15  			echo "Home has been specified to $DEVICE..."
    1.16 -			DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'`
    1.17 +			DEVID=`/sbin/blkid | sed 'p;s/"//g' | fgrep "$DEVICE" | sed 's/:.*//;q'`
    1.18  			if [ -z "$DEVID" ]; then
    1.19  				USBDELAY=`cat /sys/module/usb_storage/parameters/delay_use`
    1.20  				USBDELAY=$((2+$USBDELAY))
    1.21 @@ -85,10 +85,10 @@
    1.22  			DEVID=$DEVICE
    1.23  			if [ -x /sbin/blkid ]; then
    1.24  				# Can be a label, uuid, type or devname. DEVID gives us first: /dev/name.
    1.25 -				DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'`
    1.26 +				DEVID=`/sbin/blkid | sed 'p;s/"//g' | fgrep "$DEVICE" | sed 's/:.*//;q'`
    1.27  			fi
    1.28  			DEVID=${DEVID##*/}
    1.29 -			if [ -n "$DEVID" ] && grep -q "$DEVID" /proc/partitions ; then
    1.30 +			if [ -n "$DEVID" ] && fgrep -q "$DEVID" /proc/partitions ; then
    1.31  				echo "Mounting /home on /dev/$DEVID... "
    1.32  				[ -d /home/$USER ] && mv /home/$USER /tmp/$USER-files
    1.33  				mount /dev/$DEVID /home -o uid=1000,gid=100 2>/dev/null \