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

Add kernel polling to system.sh
author Christophe Lincoln <pankso@slitaz.org>
date Fri May 02 22:12:22 2014 +0200 (2014-05-02)
parents 3671428835e5
children 0555df1782e6
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 *)
25 continue ;;
26 esac
27 done
29 # Sound configuration stuff. First check if sound=no and remove all
30 # sound Kernel modules.
31 if [ -n "$DRIVER" ]; then
32 case "$DRIVER" in
33 no)
34 echo -n "Removing all sound kernel modules..."
35 rm -rf /lib/modules/$(uname -r)/kernel/sound
36 status
37 echo -n "Removing all sound packages..."
38 for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
39 pkg=${i#/var/lib/tazpkg/installed/}
40 echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
41 done
42 for i in alsa-lib mhwaveedit asunder libcddb ; do
43 echo 'y' | tazpkg remove $i > /dev/null
44 done
45 status ;;
46 noconf)
47 echo "Sound configuration was disabled from cmdline..." ;;
48 *)
49 if [ -x /usr/sbin/soundconf ]; then
50 echo "Using sound kernel module $DRIVER..."
51 /usr/sbin/soundconf -M $DRIVER
52 fi ;;
53 esac
54 # Sound card may already be detected by PCI-detect.
55 elif [ -d /proc/asound ]; then
56 # Restore sound config for installed system.
57 if [ -s /var/lib/alsa/asound.state ]; then
58 echo -n "Restoring last alsa configuration..."
59 alsactl restore
60 status
61 else
62 /usr/sbin/setmixer
63 fi
64 else
65 echo "Unable to configure sound card."
66 fi
68 # Locale config
69 if [ ! -s "/etc/locale.conf" ]; then
70 echo "Setting system locale to: POSIX (English)"
71 echo -e "LANG=POSIX\nLC_ALL=POSIX" > /etc/locale.conf
72 fi
73 . /etc/locale.conf
74 echo -n "Setting system locale: $LANG"
75 export LC_ALL=$LANG
76 . /lib/libtaz.sh && status
78 # Keymap config: Default to us in live mode if kmap= was not used.
79 if [ ! -s "/etc/keymap.conf" ]; then
80 echo "Setting system keymap to: us (USA)"
81 echo "us" > /etc/keymap.conf
82 fi
83 kmap=$(cat /etc/keymap.conf)
84 echo -n "Loading console keymap: $kmap"
85 /sbin/tazkeymap $kmap >/dev/null
86 status
88 # Timezone config: Set timezone using the keymap config for fr, be, fr_CH
89 # and ca with Montreal.
90 if [ ! -s "/etc/TZ" ]; then
91 case "$kmap" in
92 fr-latin1|be-latin1)
93 echo "Europe/Paris" > /etc/TZ ;;
94 fr_CH-latin1|de_CH-latin1)
95 echo "Europe/Zurich" > /etc/TZ ;;
96 cf) echo "America/Montreal" > /etc/TZ ;;
97 *) echo "UTC" > /etc/TZ ;;
98 esac
99 fi
101 # Activate an eventual swap file or partition
102 if [ "$(blkid | grep 'TYPE="swap"')" ]; then
103 for swd in $(blkid | sed '/TYPE="swap"/!d;s/:.*//'); do
104 if ! grep -q "$swd " /etc/fstab; then
105 echo "Swap memory detected on: $swd"
106 cat >> /etc/fstab <<EOT
107 $swd swap swap defaults 0 0
108 EOT
109 fi
110 done
111 fi
112 if grep -q swap /etc/fstab; then
113 echo -n "Activating swap memory..."
114 swapon -a && status
115 fi
117 # Start TazPanel
118 [ -x /usr/bin/tazpanel ] && tazpanel start
120 # Kernel polling for automount
121 echo 5000 > /sys/module/block/parameters/events_dfl_poll_msecs 2>/dev/null