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

PCI sound card my detec but setmixer dont work, we need soundconf
author Christophe Lincoln <pankso@slitaz.org>
date Tue May 13 02:51:52 2008 +0200 (2008-05-13)
parents 5054ffdd04ee
children 95e5de419e64
line source
1 #!/bin/sh
2 # /etc/init.d/hwconf.sh - SliTaz hardware autoconfiguration.
3 #
4 . /etc/init.d/rc.functions
6 # Restore sound config for installed system.
7 if [ -s /var/lib/sound-card-driver ]; then
8 echo -n "Restoring last alsa configuration..."
9 alsactl restore
10 status
11 fi
13 # Detect PCI devices and load kernel module only at first boot
14 # or in LiveCD mode.
15 if [ ! -s /var/lib/detected-modules ]; then
16 echo "Detecting PCI devices..."
17 MODULES_LIST=`lspci -k | grep "modules" | cut -d ":" -f 2 | sed s/-/_/g`
18 for mod in $MODULES_LIST
19 do
20 if ! `lsmod | grep -q "$mod"`; then
21 modname=`echo "$mod" | sed s/_/-/g`
22 echo "Loading Kernel modules: $modname"
23 detect="$detect $modname"
24 /sbin/modprobe $modname
25 fi
26 done
27 # yenta_socket = laptop
28 if `lsmod | grep -q "yenta_socket"`; then
29 detect="$detect ac battery"
30 modprobe ac
31 modprobe battery
32 fi
33 echo "$detect" > /var/lib/detected-modules
34 # Now add modules to rcS.conf
35 . /etc/rcS.conf
36 load=`echo "$LOAD_MODULES $detect" | sed s/" "/" "/g`
37 sed -i s/"LOAD_MODULES=\"$LOAD_MODULES\""/"LOAD_MODULES=\"$load\""/ \
38 /etc/rcS.conf
39 # Retry a network connection with DHCP.
40 if ! `ifconfig -a | grep -q "eth0"`; then
41 echo "Starting udhcpc client on: eth0... "
42 /sbin/udhcpc -b -i eth0 -p /var/run/udhcpc.eth0.pid
43 fi
44 fi
46 # Sound configuration stuff. First check if sound=no and remove all
47 # sound Kernel modules.
48 if grep -q "sound=" /proc/cmdline; then
49 DRIVER=`cat /proc/cmdline | sed 's/.*sound=\([^ ]*\).*/\1/'`
50 case "$DRIVER" in
51 no)
52 echo -n "Removing all sound kernel modules..."
53 rm -rf /lib/modules/`uname -r`/kernel/sound
54 status
55 echo -n "Removing all sound packages..."
56 for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
57 pkg=${i#/var/lib/tazpkg/installed/}
58 echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
59 done
60 for i in alsa-lib mhwaveedit asunder libcddb ; do
61 echo 'y' | tazpkg remove $i > /dev/null
62 done
63 status;;
64 noconf)
65 echo "Sound configuration is disable from cmdline...";;
66 *)
67 if [ -x /usr/sbin/soundconf ]; then
68 echo "Using sound kernel module $DRIVER..."
69 /usr/sbin/soundconf -M $DRIVER
70 fi;;
71 esac
72 # Sound card my already be detected by PCI-detect.
73 elif [ -d /proc/asound ]; then
74 cp /proc/asound/modules /var/lib/sound-card-driver
75 /usr/sbin/setmixer
76 if /usr/sbin/setmixer | grep -q "error"; then
77 /usr/sbin/soundconf
78 fi
79 # Start soundconf to config driver and load module for Live mode
80 # if not yet detected.
81 elif [ ! -s /var/lib/sound-card-driver ]; then
82 if [ -x /usr/sbin/soundconf ]; then
83 /usr/sbin/soundconf
84 else
85 echo "Unable to found: /usr/sbin/soundconf"
86 fi
87 fi
89 # Screen size config for slim/Xvesa (last config dialog befor login).
90 if [ ! -s /etc/X11/screen.conf -a -x /usr/bin/slim ]; then
91 # $HOME is not yet set.
92 HOME=/root
93 if grep -q "screen=*" /proc/cmdline; then
94 export NEW_SCREEN=`cat /proc/cmdline | sed 's/.*screen=\([^ ]*\).*/\1/'`
95 if [ "$NEW_SCREEN" = "text" ]; then
96 echo -n "Disabling X login manager: slim..."
97 sed -i s/'slim'/''/ /etc/rcS.conf
98 status
99 else
100 tazx `cat /etc/X11/wm.default`
101 fi
102 else
103 tazx `cat /etc/X11/wm.default`
104 fi
105 fi