slitaz-boot-scripts view etc/init.d/hwconf.sh @ rev 168

hwconf.sh: Modify only RUN_DAEMONS with screen=text (Thanks Lux)
author Christophe Lincoln <pankso@slitaz.org>
date Mon Apr 27 03:01:25 2009 +0200 (2009-04-27)
parents ae0a8f86229a
children 052f4f60ee36
line source
1 #!/bin/sh
2 # /etc/init.d/hwconf.sh - SliTaz hardware configuration.
3 #
4 # This script configure the sound card and screen. Tazhw is used earlier
5 # at boot time to autoconfigure PCI and USB devices.
6 #
7 . /etc/init.d/rc.functions
9 # Sound configuration stuff. First check if sound=no and remove all
10 # sound Kernel modules.
11 if grep -q "sound=" /proc/cmdline; then
12 DRIVER=`cat /proc/cmdline | sed 's/.*sound=\([^ ]*\).*/\1/'`
13 case "$DRIVER" in
14 no)
15 echo -n "Removing all sound kernel modules..."
16 rm -rf /lib/modules/`uname -r`/kernel/sound
17 status
18 echo -n "Removing all sound packages..."
19 for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
20 pkg=${i#/var/lib/tazpkg/installed/}
21 echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
22 done
23 for i in alsa-lib mhwaveedit asunder libcddb ; do
24 echo 'y' | tazpkg remove $i > /dev/null
25 done
26 status;;
27 noconf)
28 echo "Sound configuration was disabled from cmdline...";;
29 *)
30 if [ -x /usr/sbin/soundconf ]; then
31 echo "Using sound kernel module $DRIVER..."
32 /usr/sbin/soundconf -M $DRIVER
33 fi;;
34 esac
35 # Sound card may already be detected by PCI-detect.
36 elif [ -d /proc/asound ]; then
37 # Restore sound config for installed system.
38 if [ -s /etc/asound.state ]; then
39 echo -n "Restoring last alsa configuration..."
40 alsactl restore
41 status
42 else
43 /usr/sbin/setmixer
44 fi
45 # Start soundconf to config driver and load module for Live mode
46 # if not yet detected.
47 /usr/bin/amixer >/dev/null || /usr/sbin/soundconf
48 else
49 echo "Unable to configure sound card."
50 fi
52 # Screen size config for slim/Xvesa (last config dialog before login).
53 if [ ! -s /etc/X11/screen.conf -a -x /usr/bin/slim ]; then
54 # $HOME is not yet set.
55 HOME=/root
56 if grep -q "xarg=*" /proc/cmdline; then
57 # Add an extra argument to xserver_arguments (xarg=-2button)
58 XARG=`cat /proc/cmdline | sed 's/.*xarg=\([^ ]*\).*/\1/'`
59 sed -i "s|-screen|$XARG -screen|" /etc/slim.conf
60 fi
61 if grep -q "screen=*" /proc/cmdline; then
62 export NEW_SCREEN=`cat /proc/cmdline | sed 's/.*screen=\([^ ]*\).*/\1/'`
63 if [ "$NEW_SCREEN" = "text" ]; then
64 echo -n "Disabling X login manager: slim..."
65 . /etc/rcS.conf
66 RUN_DAEMONS=`echo $RUN_DAEMONS | sed s/' slim'/''/`
67 sed -i s/"RUN_DAEMONS.*"/"RUN_DAEMONS=\"$RUN_DAEMONS\"/" /etc/rcS.conf
68 status
69 else
70 tazx `cat /etc/X11/wm.default`
71 fi
72 else
73 tazx `cat /etc/X11/wm.default`
74 fi
75 fi