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

network.sh: better handle WEP connections, handle EAP, store Wi-Fi neworks by default; network.conf: migrate to extended format to support EAP arguments, and few more.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Mar 23 02:01:21 2015 +0200 (2015-03-23)
parents 19cbb42ff322
children 29ec74a6d359
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 echo 'Setting system locale to: POSIX (English)'
30 echo -e 'LANG=POSIX\nLC_ALL=POSIX' > /etc/locale.conf
31 fi
32 . /etc/locale.conf
33 echo -n "Setting system locale: $LANG"
34 export LC_ALL=$LANG
35 . /lib/libtaz.sh && status
37 # Keymap config: Default to us in live mode if kmap= was not used.
38 if [ ! -s '/etc/keymap.conf' ]; then
39 echo 'Setting system keymap to: us (USA)'
40 echo 'us' > /etc/keymap.conf
41 fi
42 kmap=$(cat /etc/keymap.conf)
43 echo -n "Loading console keymap: $kmap"
44 /sbin/tazkeymap $kmap >/dev/null
45 status
47 # Timezone config: Set timezone using the keymap config for fr, be, fr_CH
48 # and ca with Montreal.
49 if [ ! -s '/etc/TZ' ]; then
50 case "$kmap" in
51 fr-latin1|be-latin1)
52 echo 'Europe/Paris' > /etc/TZ ;;
53 fr_CH-latin1|de_CH-latin1)
54 echo 'Europe/Zurich' > /etc/TZ ;;
55 cf) echo 'America/Montreal' > /etc/TZ ;;
56 *) echo 'UTC' > /etc/TZ ;;
57 esac
58 fi
60 # Activate an eventual swap file or partition
61 if [ "$(blkid | grep 'TYPE="swap"')" ]; then
62 for swd in $(blkid | sed '/TYPE="swap"/!d;s/:.*//'); do
63 if ! grep -q "$swd " /etc/fstab; then
64 echo "Swap memory detected on: $swd"
65 cat >> /etc/fstab <<EOT
66 $swd swap swap defaults 0 0
67 EOT
68 fi
69 done
70 fi
71 if grep -q swap /etc/fstab; then
72 echo -n 'Activating swap memory...'
73 swapon -a && status
74 fi
76 # Start TazPanel
77 [ -x /usr/bin/tazpanel ] && tazpanel start
79 # Kernel polling for automount
80 echo 5000 > /sys/module/block/parameters/events_dfl_poll_msecs 2>/dev/null
82 # Sound configuration stuff. First check if sound=no and remove all
83 # sound Kernel modules.
84 if [ -n "$DRIVER" ]; then
85 case "$DRIVER" in
86 no)
87 echo -n 'Removing all sound kernel modules...'
88 rm -rf /lib/modules/$(uname -r)/kernel/sound
89 status
90 echo -n 'Removing all sound packages...'
91 for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
92 pkg=${i#/var/lib/tazpkg/installed/}
93 echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
94 done
95 for i in alsa-lib mhwaveedit asunder libcddb ; do
96 echo 'y' | tazpkg remove $i > /dev/null
97 done
98 status ;;
99 noconf)
100 echo 'Sound configuration was disabled from cmdline...' ;;
101 *)
102 if [ -x /usr/sbin/soundconf ]; then
103 echo "Using sound kernel module $DRIVER..."
104 /usr/sbin/soundconf -M $DRIVER
105 fi ;;
106 esac
107 # Sound card may already be detected by kernel/udev
108 elif [ -d /proc/asound ]; then
109 if [ -s /var/lib/alsa/asound.state ]; then
110 # Restore sound config for installed system
111 echo 'Restoring last alsa configuration...'
112 (sleep 2; alsactl restore) &
113 else
114 # Initialize sound card
115 alsactl init
116 fi
117 else
118 echo 'WARNING: Unable to configure sound card'
119 fi