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

etc/init.d/system.sh: remove redundant messages.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Feb 02 09:19:47 2017 +0200 (2017-02-02)
parents 2c6e9733c232
children dacad4df6c6a
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); do
15 case $opt in
16 console=*)
17 sed -i "s/tty1/${opt#console=}/g;/^tty[2-9]::/d" /etc/inittab ;;
18 sound=*)
19 DRIVER=${opt#sound=} ;;
20 xarg=*)
21 XARG="$XARG ${opt#xarg=}" ;;
22 *)
23 continue ;;
24 esac
25 done
27 # Locale config
28 if [ ! -s '/etc/locale.conf' ]; then
29 # Setting system locale to: POSIX (English)
30 echo -e 'LANG=POSIX\nLC_ALL=POSIX' > /etc/locale.conf
31 fi
32 . /etc/locale.conf
33 action 'Setting system locale: %s' "$LANG"
34 export LC_ALL=$LANG
35 status
37 # Keymap config: Default to us in live mode if kmap= was not used.
38 if [ ! -s '/etc/keymap.conf' ]; then
39 # Setting system keymap to: us (USA)
40 echo 'us' > /etc/keymap.conf
41 fi
42 kmap=$(cat /etc/keymap.conf)
43 action 'Loading console keymap: %s' "$kmap"
44 /sbin/tazkeymap $kmap >/dev/null
45 status
47 # Timezone config: Set timezone using the keymap config
48 # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
49 if [ ! -s '/etc/TZ' ]; then
50 case "$kmap" in
51 dk-*) tz='Europe/Copenhagen';;
52 de-*) tz='Europe/Berlin';;
53 es) tz='Europe/Madrid';;
54 fr-*) tz='Europe/Paris';;
55 be-*) tz='Europe/Brussels';;
56 *_CH-*) tz='Europe/Zurich';;
57 cf) tz='America/Toronto';;
58 *) tz='UTC';;
59 esac
60 echo "$tz" > /etc/TZ
61 fi
63 # Activate an eventual swap file or partition
64 if ! grep -q 'noswap' /proc/cmdline; then
65 if [ "$(blkid | grep 'TYPE="swap"')" ]; then
66 for swd in $(blkid | sed '/TYPE="swap"/!d;s/:.*//'); do
67 if ! grep -q "$swd " /etc/fstab; then
68 echo "Swap memory detected on: $swd"
69 cat >> /etc/fstab <<EOT
70 $swd swap swap defaults 0 0
71 EOT
72 fi
73 done
74 fi
75 if grep -q swap /etc/fstab; then
76 action 'Activating swap memory...'
77 swapon -a
78 status
79 fi
80 fi
82 # Start TazPanel
83 [ -x /usr/bin/tazpanel ] && tazpanel start
85 # Kernel polling for automount
86 echo 5000 > /sys/module/block/parameters/events_dfl_poll_msecs 2>/dev/null
88 # Sound configuration stuff. First check if sound=no and remove all
89 # sound Kernel modules.
90 if [ -n "$DRIVER" ]; then
91 case "$DRIVER" in
92 no)
93 action 'Removing all sound kernel modules...'
94 rm -rf /lib/modules/$(uname -r)/kernel/sound
95 status
96 action 'Removing all sound packages...'
97 for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
98 pkg=${i#/var/lib/tazpkg/installed/}
99 yes y | tazpkg remove ${pkg%/*} >/dev/null
100 done
101 for i in alsa-lib mhwaveedit asunder libcddb ; do
102 yes y | tazpkg remove $i >/dev/null
103 done
104 status ;;
105 noconf)
106 echo 'Sound configuration was disabled from cmdline...' ;;
107 *)
108 if [ -x /usr/sbin/soundconf ]; then
109 echo "Using sound kernel module $DRIVER..."
110 /usr/sbin/soundconf -M $DRIVER
111 fi ;;
112 esac
113 # Sound card may already be detected by kernel/udev
114 elif [ -d /proc/asound ]; then
115 if [ -s /var/lib/alsa/asound.state ]; then
116 # Restore sound config for installed system
117 echo 'Restoring last alsa configuration...'
118 (sleep 2; alsactl restore) &
119 else
120 # Initialize sound card
121 alsactl init
122 fi
123 else
124 echo 'WARNING: Unable to configure sound card'
125 fi