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

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