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

hwconf.sh: use Tazhw to auto configure PCI/USB devices
author Christophe Lincoln <pankso@slitaz.org>
date Wed Feb 25 00:34:02 2009 +0100 (2009-02-25)
parents 48447c5a5a52
children ddb05cd33971
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 cp /proc/asound/modules /var/lib/sound-card-driver
41 /usr/bin/amixer >/dev/null || /usr/sbin/soundconf
42 # Restore sound config for installed system.
43 if [ -s /etc/asound.state ]; then
44 echo -n "Restoring last alsa configuration..."
45 alsactl restore
46 status
47 else
48 /usr/sbin/setmixer
49 fi
50 # Start soundconf to config driver and load module for Live mode
51 # if not yet detected.
52 elif [ ! -s /var/lib/sound-card-driver ]; then
53 if [ -x /usr/sbin/soundconf ]; then
54 /usr/sbin/soundconf
55 else
56 echo "Unable to find: /usr/sbin/soundconf"
57 fi
58 fi
60 # Screen size config for slim/Xvesa (last config dialog before login).
61 if [ ! -s /etc/X11/screen.conf -a -x /usr/bin/slim ]; then
62 # $HOME is not yet set.
63 HOME=/root
64 if grep -q "screen=*" /proc/cmdline; then
65 export NEW_SCREEN=`cat /proc/cmdline | sed 's/.*screen=\([^ ]*\).*/\1/'`
66 if [ "$NEW_SCREEN" = "text" ]; then
67 echo -n "Disabling X login manager: slim..."
68 sed -i s/'slim'/''/ /etc/rcS.conf
69 status
70 else
71 tazx `cat /etc/X11/wm.default`
72 fi
73 else
74 tazx `cat /etc/X11/wm.default`
75 fi
76 fi