# HG changeset patch # User Christophe Lincoln # Date 1240840118 -7200 # Node ID 052f4f60ee36a9466cb68023875b037467f80b38 # Parent c366b7b0620eabfd1b550f1f405251bc0585dbda hwconf.sh: Speed up and tidy cmdline option diff -r c366b7b0620e -r 052f4f60ee36 etc/init.d/hwconf.sh --- a/etc/init.d/hwconf.sh Mon Apr 27 03:01:25 2009 +0200 +++ b/etc/init.d/hwconf.sh Mon Apr 27 15:48:38 2009 +0200 @@ -6,10 +6,24 @@ # . /etc/init.d/rc.functions +# Parse cmdline args for boot options (See also rcS and bootopts.sh). +for opt in `cat /proc/cmdline` +do + case $opt in + sound=*) + DRIVER=${opt#sound=} ;; + xargs=*) + XARGS=${opt#xargs=} ;; + screen=*) + SCREEN=${opt#screen=} ;; + *) + continue ;; + esac +done + # Sound configuration stuff. First check if sound=no and remove all # sound Kernel modules. -if grep -q "sound=" /proc/cmdline; then - DRIVER=`cat /proc/cmdline | sed 's/.*sound=\([^ ]*\).*/\1/'` +if [ -n "$DRIVER" ]; then case "$DRIVER" in no) echo -n "Removing all sound kernel modules..." @@ -23,14 +37,14 @@ for i in alsa-lib mhwaveedit asunder libcddb ; do echo 'y' | tazpkg remove $i > /dev/null done - status;; + status ;; noconf) - echo "Sound configuration was disabled from cmdline...";; + echo "Sound configuration was disabled from cmdline..." ;; *) if [ -x /usr/sbin/soundconf ]; then echo "Using sound kernel module $DRIVER..." /usr/sbin/soundconf -M $DRIVER - fi;; + fi ;; esac # Sound card may already be detected by PCI-detect. elif [ -d /proc/asound ]; then @@ -53,13 +67,12 @@ if [ ! -s /etc/X11/screen.conf -a -x /usr/bin/slim ]; then # $HOME is not yet set. HOME=/root - if grep -q "xarg=*" /proc/cmdline; then + if [ -n "$XARGS" ]; then # Add an extra argument to xserver_arguments (xarg=-2button) - XARG=`cat /proc/cmdline | sed 's/.*xarg=\([^ ]*\).*/\1/'` sed -i "s|-screen|$XARG -screen|" /etc/slim.conf fi - if grep -q "screen=*" /proc/cmdline; then - export NEW_SCREEN=`cat /proc/cmdline | sed 's/.*screen=\([^ ]*\).*/\1/'` + if [ -n "$SCREEN" ]; then + export NEW_SCREEN=$SCREEN if [ "$NEW_SCREEN" = "text" ]; then echo -n "Disabling X login manager: slim..." . /etc/rcS.conf