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

hwconf: sound=<driver> => load kernel module
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Mar 16 16:57:30 2008 +0100 (2008-03-16)
parents e1b3c72a0920
children 56056966923e
line source
1 #!/bin/sh
2 # /etc/init.d/hwconf.sh - SliTaz hardware autoconfiguration.
3 #
4 . /etc/init.d/rc.functions
6 # Sound configuration stuff. First check if sound=no and remoce all sound
7 # Kernel modules.
8 #
9 if grep -q "sound=" /proc/cmdline; then
10 DRIVER=`cat /proc/cmdline | sed 's/.*sound=\([^ ]*\).*/\1/'`
11 case "$DRIVER" in
12 no)
13 echo -n "Removing all sound kernel modules..."
14 rm -rf /lib/modules/`uname -r`/kernel/sound
15 status
16 echo -n "Removing all sound packages..."
17 for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
18 pkg=${i#/var/lib/tazpkg/installed/}
19 echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
20 done
21 for i in alsa-lib mhwaveedit asunder libcddb ; do
22 echo 'y' | tazpkg remove $i > /dev/null
23 done
24 status;;
25 noconf)
26 echo "Sound configuration is disable from cmdline...";;
27 *)
28 echo "Using sound kernel module $DRIVER..."
29 modprobe snd-$DRIVER
30 echo "snd-$DRIVER" > /var/lib/sound-card-driver;;
31 esac
32 elif [ ! -f /var/lib/sound-card-driver ]; then
33 if [ -x /usr/sbin/soundconf ]; then
34 # Start soundconf to config driver and load module for Live mode
35 /usr/sbin/soundconf
36 else
37 echo "Unable to found: /usr/sbin/soundconf"
38 fi
39 fi
41 # Restore sound config for installed system.
42 if [ -f /var/lib/sound-card-driver ]; then
43 echo -n "Restoring last alsa configuration..."
44 alsactl restore
45 status
46 else
47 # Remove LXpanel volumealsa if no sound configuration.
48 if [ -f /usr/share/lxpanel/profile/default/config ]; then
49 sed -i s/'volumealsa'/'space'/ /usr/share/lxpanel/profile/default/config
50 fi
51 fi
53 # Screen size config for slim/Xvesa.
54 if [ ! -f /etc/X11/screen.conf -a -x /usr/bin/slim ]; then
55 if grep -q "screen=*" /proc/cmdline; then
56 export NEW_SCREEN=`cat /proc/cmdline | sed 's/.*screen=\([^ ]*\).*/\1/'`
57 if [ "$NEW_SCREEN" = "text" ]; then
58 echo -n "Disabling X login manager: slim..."
59 sed -i s/'slim'/''/ /etc/rcS.conf
60 status
61 else
62 tazx
63 fi
64 else
65 tazx
66 fi
67 fi