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

Improve and tidy scripts, start tazhw from rcS and start network.sh earlier
author Christophe Lincoln <pankso@slitaz.org>
date Tue Apr 21 01:46:21 2009 +0200 (2009-04-21)
parents 4ae0810cb439
children c366b7b0620e
line source
1 #!/bin/sh
2 # /etc/init.d/hwconf.sh - SliTaz hardware configuration.
3 #
4 # This script configure the sound card and screen. Tazhw is used earlier
5 # at boot time to autoconfigure PCI and USB devices.
6 #
7 . /etc/init.d/rc.functions
9 # Sound configuration stuff. First check if sound=no and remove all
10 # sound Kernel modules.
11 if grep -q "sound=" /proc/cmdline; then
12 DRIVER=`cat /proc/cmdline | sed 's/.*sound=\([^ ]*\).*/\1/'`
13 case "$DRIVER" in
14 no)
15 echo -n "Removing all sound kernel modules..."
16 rm -rf /lib/modules/`uname -r`/kernel/sound
17 status
18 echo -n "Removing all sound packages..."
19 for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
20 pkg=${i#/var/lib/tazpkg/installed/}
21 echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
22 done
23 for i in alsa-lib mhwaveedit asunder libcddb ; do
24 echo 'y' | tazpkg remove $i > /dev/null
25 done
26 status;;
27 noconf)
28 echo "Sound configuration was disabled from cmdline...";;
29 *)
30 if [ -x /usr/sbin/soundconf ]; then
31 echo "Using sound kernel module $DRIVER..."
32 /usr/sbin/soundconf -M $DRIVER
33 fi;;
34 esac
35 # Sound card may already be detected by PCI-detect.
36 elif [ -d /proc/asound ]; then
37 # Restore sound config for installed system.
38 if [ -s /etc/asound.state ]; then
39 echo -n "Restoring last alsa configuration..."
40 alsactl restore
41 status
42 else
43 /usr/sbin/setmixer
44 fi
45 # Start soundconf to config driver and load module for Live mode
46 # if not yet detected.
47 /usr/bin/amixer >/dev/null || /usr/sbin/soundconf
48 else
49 echo "Unable to configure sound card."
50 fi
52 # Screen size config for slim/Xvesa (last config dialog before login).
53 if [ ! -s /etc/X11/screen.conf -a -x /usr/bin/slim ]; then
54 # $HOME is not yet set.
55 HOME=/root
56 if grep -q "xarg=*" /proc/cmdline; then
57 # Add an extra argument to xserver_arguments (xarg=-2button)
58 XARG=`cat /proc/cmdline | sed 's/.*xarg=\([^ ]*\).*/\1/'`
59 sed -i "s|-screen|$XARG -screen|" /etc/slim.conf
60 fi
61 if grep -q "screen=*" /proc/cmdline; then
62 export NEW_SCREEN=`cat /proc/cmdline | sed 's/.*screen=\([^ ]*\).*/\1/'`
63 if [ "$NEW_SCREEN" = "text" ]; then
64 echo -n "Disabling X login manager: slim..."
65 sed -i s/'slim'/''/ /etc/rcS.conf
66 status
67 else
68 tazx `cat /etc/X11/wm.default`
69 fi
70 else
71 tazx `cat /etc/X11/wm.default`
72 fi
73 fi