slitaz-boot-scripts view etc/init.d/system.sh @ rev 348

We dont need soundconf anymore at boot time
author Christophe Lincoln <pankso@slitaz.org>
date Sun Feb 16 19:03:46 2014 +0100 (2014-02-16)
parents 612a6f9874c0
children 6342e4d26e04
line source
1 #!/bin/sh
2 #
3 # /etc/init.d/system.sh : SliTaz hardware configuration
4 #
5 # This script configures the sound card and screen. Tazhw is used earlier
6 # at boot time to autoconfigure PCI and USB devices. It also configures
7 # system language, keyboard and TZ in live mode and start X.
8 #
9 . /etc/init.d/rc.functions
10 . /etc/rcS.conf
12 # Parse cmdline args for boot options (See also rcS and bootopts.sh).
13 XARG=""
14 for opt in $(cat /proc/cmdline)
15 do
16 case $opt in
17 console=*)
18 sed -i "s/tty1/${opt#console=}/g;/^tty[2-9]::/d" \
19 /etc/inittab ;;
20 sound=*)
21 DRIVER=${opt#sound=} ;;
22 xarg=*)
23 XARG="$XARG ${opt#xarg=}" ;;
24 screen=*)
25 SCREEN=${opt#screen=} ;;
26 *)
27 continue ;;
28 esac
29 done
31 # Sound configuration stuff. First check if sound=no and remove all
32 # sound Kernel modules.
33 if [ -n "$DRIVER" ]; then
34 case "$DRIVER" in
35 no)
36 echo -n "Removing all sound kernel modules..."
37 rm -rf /lib/modules/$(uname -r)/kernel/sound
38 status
39 echo -n "Removing all sound packages..."
40 for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
41 pkg=${i#/var/lib/tazpkg/installed/}
42 echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
43 done
44 for i in alsa-lib mhwaveedit asunder libcddb ; do
45 echo 'y' | tazpkg remove $i > /dev/null
46 done
47 status ;;
48 noconf)
49 echo "Sound configuration was disabled from cmdline..." ;;
50 *)
51 if [ -x /usr/sbin/soundconf ]; then
52 echo "Using sound kernel module $DRIVER..."
53 /usr/sbin/soundconf -M $DRIVER
54 fi ;;
55 esac
56 # Sound card may already be detected by PCI-detect.
57 elif [ -d /proc/asound ]; then
58 # Restore sound config for installed system.
59 if [ -s /var/lib/alsa/asound.state ]; then
60 echo -n "Restoring last alsa configuration..."
61 alsactl restore
62 status
63 else
64 /usr/sbin/setmixer
65 fi
66 else
67 echo "Unable to configure sound card."
68 fi
70 # Locale config
71 if [ ! -s "/etc/locale.conf" ]; then
72 echo "Setting system locale to: POSIX (English)"
73 echo -e "LANG=POSIX\nLC_ALL=POSIX" > /etc/locale.conf
74 fi
75 . /etc/locale.conf
76 echo -n "Setting system locale: $LANG"
77 export LC_ALL=$LANG
78 . /lib/libtaz.sh && status
80 # Keymap config: Default to us in live mode if kmap= was not used.
81 if [ ! -s "/etc/keymap.conf" ]; then
82 echo "Setting system keymap to: us (USA)"
83 echo "us" > /etc/keymap.conf
84 fi
85 kmap=$(cat /etc/keymap.conf)
86 echo -n "Loading console keymap: $kmap"
87 /sbin/tazkeymap $kmap >/dev/null
88 status
90 # Timezone config: Set timezone using the keymap config for fr, be, fr_CH
91 # and ca with Montreal.
92 if [ ! -s "/etc/TZ" ]; then
93 case "$kmap" in
94 fr-latin1|be-latin1)
95 echo "Europe/Paris" > /etc/TZ ;;
96 fr_CH-latin1|de_CH-latin1)
97 echo "Europe/Zurich" > /etc/TZ ;;
98 cf) echo "America/Montreal" > /etc/TZ ;;
99 *) echo "UTC" > /etc/TZ ;;
100 esac
101 fi
103 # Activate an eventual swap file or partition
104 if [ "$(blkid | grep 'TYPE="swap"')" ]; then
105 for swd in $(blkid | sed '/TYPE="swap"/!d;s/:.*//'); do
106 if ! grep -q "$swd " /etc/fstab; then
107 echo "Swap memory detected on: $swd"
108 cat >> /etc/fstab <<EOT
109 $swd swap swap defaults 0 0
110 EOT
111 fi
112 done
113 fi
114 if grep -q swap /etc/fstab; then
115 echo -n "Activating swap memory..."
116 swapon -a && status
117 fi
119 # Xorg auto configuration: $HOME is not yet set. We config even if
120 # screen=text so X can be started by users via 'startx'
121 if [ ! -s /etc/X11/xorg.conf ] && [ -x /usr/bin/Xorg ]; then
122 echo "Configuring Xorg..."
123 HOME=/root
124 tazx config-xorg 2>/var/log/xorg.configure.log
125 fi
127 # Start TazPanel
128 [ -x /usr/bin/tazpanel ] && tazpanel start