slitaz-boot-scripts rev 169
hwconf.sh: Speed up and tidy cmdline option
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon Apr 27 15:48:38 2009 +0200 (2009-04-27) |
parents | c366b7b0620e |
children | 31cdb3990493 |
files | etc/init.d/hwconf.sh |
line diff
1.1 --- a/etc/init.d/hwconf.sh Mon Apr 27 03:01:25 2009 +0200 1.2 +++ b/etc/init.d/hwconf.sh Mon Apr 27 15:48:38 2009 +0200 1.3 @@ -6,10 +6,24 @@ 1.4 # 1.5 . /etc/init.d/rc.functions 1.6 1.7 +# Parse cmdline args for boot options (See also rcS and bootopts.sh). 1.8 +for opt in `cat /proc/cmdline` 1.9 +do 1.10 + case $opt in 1.11 + sound=*) 1.12 + DRIVER=${opt#sound=} ;; 1.13 + xargs=*) 1.14 + XARGS=${opt#xargs=} ;; 1.15 + screen=*) 1.16 + SCREEN=${opt#screen=} ;; 1.17 + *) 1.18 + continue ;; 1.19 + esac 1.20 +done 1.21 + 1.22 # Sound configuration stuff. First check if sound=no and remove all 1.23 # sound Kernel modules. 1.24 -if grep -q "sound=" /proc/cmdline; then 1.25 - DRIVER=`cat /proc/cmdline | sed 's/.*sound=\([^ ]*\).*/\1/'` 1.26 +if [ -n "$DRIVER" ]; then 1.27 case "$DRIVER" in 1.28 no) 1.29 echo -n "Removing all sound kernel modules..." 1.30 @@ -23,14 +37,14 @@ 1.31 for i in alsa-lib mhwaveedit asunder libcddb ; do 1.32 echo 'y' | tazpkg remove $i > /dev/null 1.33 done 1.34 - status;; 1.35 + status ;; 1.36 noconf) 1.37 - echo "Sound configuration was disabled from cmdline...";; 1.38 + echo "Sound configuration was disabled from cmdline..." ;; 1.39 *) 1.40 if [ -x /usr/sbin/soundconf ]; then 1.41 echo "Using sound kernel module $DRIVER..." 1.42 /usr/sbin/soundconf -M $DRIVER 1.43 - fi;; 1.44 + fi ;; 1.45 esac 1.46 # Sound card may already be detected by PCI-detect. 1.47 elif [ -d /proc/asound ]; then 1.48 @@ -53,13 +67,12 @@ 1.49 if [ ! -s /etc/X11/screen.conf -a -x /usr/bin/slim ]; then 1.50 # $HOME is not yet set. 1.51 HOME=/root 1.52 - if grep -q "xarg=*" /proc/cmdline; then 1.53 + if [ -n "$XARGS" ]; then 1.54 # Add an extra argument to xserver_arguments (xarg=-2button) 1.55 - XARG=`cat /proc/cmdline | sed 's/.*xarg=\([^ ]*\).*/\1/'` 1.56 sed -i "s|-screen|$XARG -screen|" /etc/slim.conf 1.57 fi 1.58 - if grep -q "screen=*" /proc/cmdline; then 1.59 - export NEW_SCREEN=`cat /proc/cmdline | sed 's/.*screen=\([^ ]*\).*/\1/'` 1.60 + if [ -n "$SCREEN" ]; then 1.61 + export NEW_SCREEN=$SCREEN 1.62 if [ "$NEW_SCREEN" = "text" ]; then 1.63 echo -n "Disabling X login manager: slim..." 1.64 . /etc/rcS.conf