slitaz-modular view tank/overlay/etc/init.d/system.sh @ rev 178

Remove ashism ==
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 26 08:25:16 2019 +0100 (2019-02-26)
parents 2d0d25925042
children
line source
1 #!/bin/sh
2 # /etc/init.d/system.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. It also configures
6 # system language, keyboard and TZ in live mode.
7 #
8 . /etc/init.d/rc.functions
10 # Parse cmdline args for boot options (See also rcS and bootopts.sh).
11 XARG=""
12 for opt in $(cat /proc/cmdline)
13 do
14 case $opt in
15 console=*)
16 sed -i "s/tty1/${opt#console=}/g;/^tty[2-9]::/d" \
17 /etc/inittab ;;
18 sound=*)
19 DRIVER=${opt#sound=} ;;
20 xarg=*)
21 XARG="$XARG ${opt#xarg=}" ;;
22 screen=text)
23 SCREEN=text
24 # Disable X.
25 echo -n "Disabling X login manager: slim..."
26 . /etc/rcS.conf
27 RUN_DAEMONS=$(echo $RUN_DAEMONS | sed s/' slim'/''/)
28 sed -i s/"RUN_DAEMONS.*"/"RUN_DAEMONS=\"$RUN_DAEMONS\"/" /etc/rcS.conf
29 status ;;
30 screen=*)
31 SCREEN=${opt#screen=} ;;
32 *)
33 continue ;;
34 esac
35 done
37 # Sound configuration stuff. First check if sound=no and remove all
38 # sound Kernel modules.
39 if [ -n "$DRIVER" ]; then
40 case "$DRIVER" in
41 no)
42 echo -n "Removing all sound kernel modules..."
43 rm -rf /lib/modules/`uname -r`/kernel/sound
44 status
45 echo -n "Removing all sound packages..."
46 for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
47 pkg=${i#/var/lib/tazpkg/installed/}
48 echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
49 done
50 for i in alsa-lib mhwaveedit asunder libcddb ; do
51 echo 'y' | tazpkg remove $i > /dev/null
52 done
53 status ;;
54 noconf)
55 echo "Sound configuration was disabled from cmdline..." ;;
56 *)
57 if [ -x /usr/sbin/soundconf ]; then
58 echo "Using sound kernel module $DRIVER..."
59 /usr/sbin/soundconf -M $DRIVER
60 fi ;;
61 esac
62 # Sound card may already be detected by PCI-detect.
63 elif [ -d /proc/asound ]; then
64 # Restore sound config for installed system.
65 if [ -s /var/lib/alsa/asound.state ]; then
66 echo -n "Restoring last alsa configuration..."
67 alsactl restore
68 status
69 else
70 /usr/sbin/setmixer
71 fi
72 # Start soundconf to config driver and load module for Live mode
73 # if not yet detected.
74 /usr/bin/amixer >/dev/null || /usr/sbin/soundconf
75 else
76 echo "Unable to configure sound card."
77 fi
79 # Start TazPanel
80 [ -x /usr/bin/tazpanel ] && tazpanel start
82 # Auto recharge packages list (after network connection of course)
83 [ "$RECHARGE_PACKAGES_LIST" = "yes" ] && tazpkg recharge &
85 # Locale config. Do a gui config for both lang/keymap.
86 echo "Checking if /etc/locale.conf exists... "
87 if [ ! -s "/etc/locale.conf" ]; then
88 if [ "$SCREEN" != "text" ] && [ -x /usr/bin/Xorg ]; then
89 echo "Starting TazBox configuration..."
90 DISPLAY=:1 tazbox boot
91 else
92 tazlocale
93 fi
94 else
95 lang=$(cat /etc/locale.conf | fgrep LANG | cut -d "=" -f 2)
96 echo -n "Locale configuration: $lang" && status
97 fi
99 # Keymap config.
100 if [ -s "/etc/keymap.conf" ]; then
101 KEYMAP=$(cat /etc/keymap.conf)
102 echo "Keymap configuration: $KEYMAP"
103 if [ -x /bin/loadkeys ]; then
104 loadkeys $KEYMAP
105 else
106 loadkmap < /usr/share/kmap/$KEYMAP.kmap
107 fi
108 else
109 tazkeymap
110 fi
112 # Timezone config. Set timezone using the keymap config for fr, be, fr_CH
113 # and ca with Montreal.
114 if [ ! -s "/etc/TZ" ]; then
115 map=$(cat /etc/keymap.conf)
116 case "$map" in
117 fr-latin1|be-latin1)
118 echo "Europe/Paris" > /etc/TZ ;;
119 fr_CH-latin1|de_CH-latin1)
120 echo "Europe/Zurich" > /etc/TZ ;;
121 cf)
122 echo "America/Montreal" > /etc/TZ ;;
123 *)
124 echo "UTC" > /etc/TZ ;;
125 esac
126 fi
128 # Xorg auto configuration.
129 if [ "$SCREEN" != "text" -a ! -s /etc/X11/xorg.conf -a -x /usr/bin/Xorg ]; then
130 echo "Configuring Xorg..."
131 # $HOME is not yet set.
132 HOME=/root
133 sed -i 's|/usr/bin/Xvesa|/usr/bin/Xorg|' /etc/slim.conf
134 sed -i s/"^xserver_arguments"/'\#xserver_arguments'/ /etc/slim.conf
135 tazx config-xorg 2>/var/log/xorg.configure.log
136 fi
138 # Start X sesssion as soon as possible in Live/frugal mode. HD install
139 # can use FAST_BOOT_X which starts X beforehand. In live mode we need
140 # keymap config for Xorg configuration and a working Xorg config.
141 #if [ "$SCREEN" != "text" ] && [ -x /usr/bin/slim ]; then
142 #if fgrep -q root=/dev/null /proc/cmdline; then
143 #/etc/init.d/slim start
144 #fi
145 #fi
147 # Firefox hack to get the right locale.
148 if fgrep -q "fr_" /etc/locale.conf; then
149 # But is the fox installed ?
150 if [ -f "/var/lib/tazpkg/installed/firefox/receipt" ]; then
151 . /var/lib/tazpkg/installed/firefox/receipt
152 sed -i 's/en-US/fr/' /etc/firefox/pref/firefox-l10n.js
153 fi
154 fi