slitaz-boot-scripts view etc/init.d/i18n.sh @ rev 153

Improve and tidy scripts, start tazhw from rcS and start network.sh earlier
author Christophe Lincoln <pankso@slitaz.org>
date Tue Apr 21 01:46:21 2009 +0200 (2009-04-21)
parents 58cc6775e0f0
children 16c27ed1f2c9
line source
1 #!/bin/sh
2 # /etc/init.d/i18n.sh - Internationalization initialisation.
3 #
4 # This script configure SliTaz default keymap, locale, timezone.
5 #
6 . /etc/init.d/rc.functions
8 # Locale config.
9 echo "Cheking if /etc/locale.conf exist... "
10 if [ -s "/etc/locale.conf" ]; then
11 echo -n "Locale configuration file exists... "
12 status
13 else
14 tazlocale
15 fi
17 # Keymap config.
18 if [ -s "/etc/keymap.conf" ]; then
19 KEYMAP=`cat /etc/keymap.conf`
20 echo "Keymap configuration: $KEYMAP"
21 if [ -x /bin/loadkeys ]; then
22 loadkeys $KEYMAP
23 else
24 loadkmap < /usr/share/kmap/$KEYMAP.kmap
25 fi
26 else
27 tazkeymap
28 fi
30 # Timezone config. Set timezone using the keymap config for fr, be, fr_CH
31 # and ca with Montreal.
32 if [ ! -s "/etc/TZ" ]; then
33 KEYMAP=`cat /etc/keymap.conf`
34 case "$KEYMAP" in
35 fr-latin1|be-latin1)
36 echo -n "Setting timezone to Europe/Paris... "
37 echo "Europe/Paris" > /etc/TZ && status
38 ;;
39 fr_CH-latin1|de_CH-latin1)
40 echo -n "Setting timezone to Europe/Zurich... "
41 echo "Europe/Zurich" > /etc/TZ && status
42 ;;
43 cf)
44 echo -n "Setting timezone to America/Montreal... "
45 echo "America/Montreal" > /etc/TZ && status
46 ;;
47 *)
48 echo -n "Setting default timezone to UTC... "
49 echo "UTC" > /etc/TZ && status
50 ;;
51 esac
52 fi
54 # Firefox hack to get the right locale.
55 if grep -q "fr_*" /etc/locale.conf; then
56 # But is the fox installed ?
57 if [ -f "/var/lib/tazpkg/installed/firefox/receipt" ]; then
58 . /var/lib/tazpkg/installed/firefox/receipt
59 sed -i 's/en-US/fr/' /etc/firefox/pref/firefox-l10n.js
60 fi
61 fi
63 # Gen a motd in french if fr_* or in English by default.
64 if [ ! -s "/etc/motd" ]; then
65 if grep -q "fr_*" /etc/locale.conf; then
66 # FR
67 cat > /etc/motd << "EOF"
70 (°- { Documentation dans /usr/share/doc. Utiliser 'less -EM' pour,
71 //\ lire des fichiers, devenir root avec 'su' et éditer avec 'nano'.
72 v_/_ Taper 'startx' pour lancer une session X. }
74 SliTaz GNU/Linux est distribuée dans l'espoir qu'elle sera utile, mais
75 alors SANS AUCUNE GARANTIE.
78 EOF
79 else
80 # EN
81 cat > /etc/motd << "EOF"
84 (°- { Documentation in /usr/share/doc. Use 'less -EM' to read files,
85 //\ become root with 'su' and edit using 'nano'.
86 v_/_ Type 'startx' to start a X window session. }
88 SliTaz GNU/Linux is distributed in the hope that it will be useful, but
89 with ABSOLUTELY NO WARRANTY.
92 EOF
94 fi
96 fi