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

rcS: add cdrom= parameter
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue May 20 15:58:16 2008 +0000 (2008-05-20)
parents 17460a2694e6
children 79fc62b090f8
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 if [ ! -f /var/run/udhcpc.eth0.pid ]; then
42 echo "Starting udhcpc client on: eth0... "
43 /sbin/udhcpc -b -i eth0 -p /var/run/udhcpc.eth0.pid
44 fi
45 fi
46 fi
48 # Sound configuration stuff. First check if sound=no and remove all
49 # sound Kernel modules.
50 if grep -q "sound=" /proc/cmdline; then
51 DRIVER=`cat /proc/cmdline | sed 's/.*sound=\([^ ]*\).*/\1/'`
52 case "$DRIVER" in
53 no)
54 echo -n "Removing all sound kernel modules..."
55 rm -rf /lib/modules/`uname -r`/kernel/sound
56 status
57 echo -n "Removing all sound packages..."
58 for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
59 pkg=${i#/var/lib/tazpkg/installed/}
60 echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
61 done
62 for i in alsa-lib mhwaveedit asunder libcddb ; do
63 echo 'y' | tazpkg remove $i > /dev/null
64 done
65 status;;
66 noconf)
67 echo "Sound configuration is disable from cmdline...";;
68 *)
69 if [ -x /usr/sbin/soundconf ]; then
70 echo "Using sound kernel module $DRIVER..."
71 /usr/sbin/soundconf -M $DRIVER
72 fi;;
73 esac
74 # Sound card my already be detected by PCI-detect.
75 elif [ -d /proc/asound ]; then
76 cp /proc/asound/modules /var/lib/sound-card-driver
77 /usr/bin/amixer >/dev/null || /usr/sbin/soundconf
78 /usr/sbin/setmixer
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