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

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