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

rcS: export SCREEN and source functions in user-home.sh
author Christophe Lincoln <pankso@slitaz.org>
date Fri Apr 29 17:43:22 2011 +0200 (2011-04-29)
parents 36546e2a0d3a
children
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=text)
19 SCREEN=text
20 # Disable X.
21 echo -n "Disabling X login manager: slim..."
22 . /etc/rcS.conf
23 RUN_DAEMONS=`echo $RUN_DAEMONS | sed s/' slim'/''/`
24 sed -i s/"RUN_DAEMONS.*"/"RUN_DAEMONS=\"$RUN_DAEMONS\"/" /etc/rcS.conf
25 status ;;
26 screen=*)
27 SCREEN=${opt#screen=} ;;
28 *)
29 continue ;;
30 esac
31 done
33 # Sound configuration stuff. First check if sound=no and remove all
34 # sound Kernel modules.
35 if [ -n "$DRIVER" ]; then
36 case "$DRIVER" in
37 no)
38 echo -n "Removing all sound kernel modules..."
39 rm -rf /lib/modules/`uname -r`/kernel/sound
40 status
41 echo -n "Removing all sound packages..."
42 for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
43 pkg=${i#/var/lib/tazpkg/installed/}
44 echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
45 done
46 for i in alsa-lib mhwaveedit asunder libcddb ; do
47 echo 'y' | tazpkg remove $i > /dev/null
48 done
49 status ;;
50 noconf)
51 echo "Sound configuration was disabled from cmdline..." ;;
52 *)
53 if [ -x /usr/sbin/soundconf ]; then
54 echo "Using sound kernel module $DRIVER..."
55 /usr/sbin/soundconf -M $DRIVER
56 fi ;;
57 esac
58 # Sound card may already be detected by PCI-detect.
59 elif [ -d /proc/asound ]; then
60 # Restore sound config for installed system.
61 if [ -s /etc/asound.state ]; then
62 echo -n "Restoring last alsa configuration..."
63 alsactl restore
64 status
65 else
66 /usr/sbin/setmixer
67 fi
68 # Start soundconf to config driver and load module for Live mode
69 # if not yet detected.
70 /usr/bin/amixer >/dev/null || /usr/sbin/soundconf
71 else
72 echo "Unable to configure sound card."
73 fi