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

hwconf.sh: add xarg= for slim.conf/xserver_arguments
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Mar 09 10:16:51 2009 +0000 (2009-03-09)
parents ddb05cd33971
children ae0a8f86229a
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 # Restore sound config for installed system.
41 if [ -s /etc/asound.state ]; then
42 echo -n "Restoring last alsa configuration..."
43 alsactl restore
44 status
45 else
46 /usr/sbin/setmixer
47 fi
48 # Start soundconf to config driver and load module for Live mode
49 # if not yet detected.
50 /usr/bin/amixer >/dev/null || /usr/sbin/soundconf
51 else
52 echo "Unable to configure sound card."
53 fi
55 # Screen size config for slim/Xvesa (last config dialog before login).
56 if [ ! -s /etc/X11/screen.conf -a -x /usr/bin/slim ]; then
57 # $HOME is not yet set.
58 HOME=/root
59 if grep -q "xarg=*" /proc/cmdline; then
60 # Add an extra argument to xserver_arguments (xarg=-2button)
61 XARG=`cat /proc/cmdline | sed 's/.*xarg=\([^ ]*\).*/\1/'`
62 sed -i "s|-screen|$XARG -screen|" /etc/slim.conf
63 fi
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