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

Typo in wifi config message
author Christophe Lincoln <pankso@slitaz.org>
date Mon May 12 17:34:08 2008 +0200 (2008-05-12)
parents def856d355bd
children 5054ffdd04ee
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 [ -f /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 [ ! -f /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 # Start soundconf to config driver and load module for Live mode
77 # if not yet detected.
78 elif [ ! -f /var/lib/sound-card-driver ]; then
79 if [ -x /usr/sbin/soundconf ]; then
80 /usr/sbin/soundconf
81 else
82 echo "Unable to found: /usr/sbin/soundconf"
83 fi
84 fi
86 # Screen size config for slim/Xvesa (last config dialog befor login).
87 if [ ! -f /etc/X11/screen.conf -a -x /usr/bin/slim ]; then
88 # $HOME is not yet set.
89 HOME=/root
90 if grep -q "screen=*" /proc/cmdline; then
91 export NEW_SCREEN=`cat /proc/cmdline | sed 's/.*screen=\([^ ]*\).*/\1/'`
92 if [ "$NEW_SCREEN" = "text" ]; then
93 echo -n "Disabling X login manager: slim..."
94 sed -i s/'slim'/''/ /etc/rcS.conf
95 status
96 else
97 tazx `cat /etc/X11/wm.default`
98 fi
99 else
100 tazx `cat /etc/X11/wm.default`
101 fi
102 fi