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

Tiny edits
author Paul Issott <paul@slitaz.org>
date Sat Oct 24 12:29:17 2009 +0000 (2009-10-24)
parents 75125fb17674
children ddd1db038d3b
line source
1 #!/bin/sh
2 # /etc/init.d/hwconf.sh - SliTaz hardware configuration.
3 #
4 # This script configures 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 # Parse cmdline args for boot options (See also rcS and bootopts.sh).
10 XARG=""
11 for opt in `cat /proc/cmdline`
12 do
13 case $opt in
14 sound=*)
15 DRIVER=${opt#sound=} ;;
16 xarg=*)
17 XARG="$XARG ${opt#xarg=}" ;;
18 screen=*)
19 SCREEN=${opt#screen=} ;;
20 *)
21 continue ;;
22 esac
23 done
25 # Sound configuration stuff. First check if sound=no and remove all
26 # sound Kernel modules.
27 if [ -n "$DRIVER" ]; then
28 case "$DRIVER" in
29 no)
30 echo -n "Removing all sound kernel modules..."
31 rm -rf /lib/modules/`uname -r`/kernel/sound
32 status
33 echo -n "Removing all sound packages..."
34 for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
35 pkg=${i#/var/lib/tazpkg/installed/}
36 echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
37 done
38 for i in alsa-lib mhwaveedit asunder libcddb ; do
39 echo 'y' | tazpkg remove $i > /dev/null
40 done
41 status ;;
42 noconf)
43 echo "Sound configuration was disabled from cmdline..." ;;
44 *)
45 if [ -x /usr/sbin/soundconf ]; then
46 echo "Using sound kernel module $DRIVER..."
47 /usr/sbin/soundconf -M $DRIVER
48 fi ;;
49 esac
50 # Sound card may already be detected by PCI-detect.
51 elif [ -d /proc/asound ]; then
52 # Restore sound config for installed system.
53 if [ -s /etc/asound.state ]; then
54 echo -n "Restoring last alsa configuration..."
55 alsactl restore
56 status
57 else
58 /usr/sbin/setmixer
59 fi
60 # Start soundconf to config driver and load module for Live mode
61 # if not yet detected.
62 /usr/bin/amixer >/dev/null || /usr/sbin/soundconf
63 else
64 echo "Unable to configure sound card."
65 fi
67 # Screen size config for slim/Xvesa (last config dialog before login).
68 if [ ! -s /etc/X11/screen.conf -a -x /usr/bin/slim ]; then
69 # $HOME is not yet set.
70 HOME=/root
71 if [ -n "$XARG" ]; then
72 # Add an extra argument to xserver_arguments (xarg=-2button)
73 sed -i "s| -screen|$XARG -screen|" /etc/slim.conf
74 fi
75 if [ -n "$SCREEN" ]; then
76 case "$SCREEN" in
77 text)
78 # Disable X.
79 echo -n "Disabling X login manager: slim..."
80 . /etc/rcS.conf
81 RUN_DAEMONS=`echo $RUN_DAEMONS | sed s/' slim'/''/`
82 sed -i s/"RUN_DAEMONS.*"/"RUN_DAEMONS=\"$RUN_DAEMONS\"/" /etc/rcS.conf
83 status ;;
84 auto)
85 # Auto detect screen resolution.
86 export NEW_SCREEN=`Xvesa -listmodes 2>&1 | grep ^0x | \
87 awk '{ printf "%s %s\n",$2 }' \
88 | sort -nr | grep x[1-2][4-6] | head -n 1`
89 tazx `cat /etc/X11/wm.default` ;;
90 *)
91 # Use specified screen resolution.
92 export NEW_SCREEN=$SCREEN
93 tazx `cat /etc/X11/wm.default` ;;
94 esac
95 else
96 tazx `cat /etc/X11/wm.default`
97 fi
98 fi