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

hwconf.sh: module can be listed but not installed
author Christophe Lincoln <pankso@slitaz.org>
date Wed Feb 18 01:35:59 2009 +0100 (2009-02-18)
parents d3bf7f751e5f
children 7f56f98aef11
line source
1 #!/bin/sh
2 # /etc/init.d/hwconf.sh - SliTaz hardware autoconfiguration.
3 #
4 . /etc/init.d/rc.functions
6 # Detect PCI devices and load kernel module only at first boot
7 # or in LiveCD mode.
8 if [ ! -s /var/lib/detected-modules ]; then
10 . /etc/rcS.conf
12 # We need module_name to match output of lsmod.
13 echo "Detecting PCI devices..."
14 MODULES_LIST=`lspci -k | grep "modules" | cut -d ":" -f 2 | sed s/-/_/g`
15 for mod in $MODULES_LIST
16 do
17 if ! lsmod | grep -q "$mod"; then
18 if [ -f "$(modprobe -l $mod)" ]; then
19 echo "Loading Kernel modules: $mod"
20 detect="$detect $mod"
21 /sbin/modprobe $mod
22 else
23 echo "Missing module: $mod"
24 fi
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 sed -i 's/= cpu/= batt\n}\n\nPlugin {\n type = cpu/' \
33 /etc/lxpanel/default/panels/panel 2> /dev/null
34 fi
35 echo "$detect" > /var/lib/detected-modules
36 # Now add modules to rcS.conf
37 load=`echo "$LOAD_MODULES $detect" | sed s/" "/" "/g`
38 sed -i s/"LOAD_MODULES=\"$LOAD_MODULES\""/"LOAD_MODULES=\"$load\""/ \
39 /etc/rcS.conf
40 # Retry a network connection with DHCP.
41 if ifconfig -a | grep -q "eth0"; then
42 if [ ! -f /var/run/udhcpc.eth0.pid ]; then
43 echo "Starting udhcpc client on: eth0... "
44 /sbin/udhcpc -b -i eth0 -p /var/run/udhcpc.eth0.pid
45 fi
46 fi
47 fi
49 # Sound configuration stuff. First check if sound=no and remove all
50 # sound Kernel modules.
51 if grep -q "sound=" /proc/cmdline; then
52 DRIVER=`cat /proc/cmdline | sed 's/.*sound=\([^ ]*\).*/\1/'`
53 case "$DRIVER" in
54 no)
55 echo -n "Removing all sound kernel modules..."
56 rm -rf /lib/modules/`uname -r`/kernel/sound
57 status
58 echo -n "Removing all sound packages..."
59 for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
60 pkg=${i#/var/lib/tazpkg/installed/}
61 echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
62 done
63 for i in alsa-lib mhwaveedit asunder libcddb ; do
64 echo 'y' | tazpkg remove $i > /dev/null
65 done
66 status;;
67 noconf)
68 echo "Sound configuration was disabled from cmdline...";;
69 *)
70 if [ -x /usr/sbin/soundconf ]; then
71 echo "Using sound kernel module $DRIVER..."
72 /usr/sbin/soundconf -M $DRIVER
73 fi;;
74 esac
75 # Sound card may already be detected by PCI-detect.
76 elif [ -d /proc/asound ]; then
77 cp /proc/asound/modules /var/lib/sound-card-driver
78 /usr/bin/amixer >/dev/null || /usr/sbin/soundconf
79 # Restore sound config for installed system.
80 if [ -s /etc/asound.state ]; then
81 echo -n "Restoring last alsa configuration..."
82 alsactl restore
83 status
84 else
85 /usr/sbin/setmixer
86 fi
87 # Start soundconf to config driver and load module for Live mode
88 # if not yet detected.
89 elif [ ! -s /var/lib/sound-card-driver ]; then
90 if [ -x /usr/sbin/soundconf ]; then
91 /usr/sbin/soundconf
92 else
93 echo "Unable to find: /usr/sbin/soundconf"
94 fi
95 fi
97 # Screen size config for slim/Xvesa (last config dialog before login).
98 if [ ! -s /etc/X11/screen.conf -a -x /usr/bin/slim ]; then
99 # $HOME is not yet set.
100 HOME=/root
101 if grep -q "screen=*" /proc/cmdline; then
102 export NEW_SCREEN=`cat /proc/cmdline | sed 's/.*screen=\([^ ]*\).*/\1/'`
103 if [ "$NEW_SCREEN" = "text" ]; then
104 echo -n "Disabling X login manager: slim..."
105 sed -i s/'slim'/''/ /etc/rcS.conf
106 status
107 else
108 tazx `cat /etc/X11/wm.default`
109 fi
110 else
111 tazx `cat /etc/X11/wm.default`
112 fi
113 fi