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

Add i18n.sh (config keymap, locale and TZ)
author Christophe Lincoln <pankso@slitaz.org>
date Fri Nov 30 12:31:59 2007 +0100 (2007-11-30)
parents
children d7ba6f674f9c
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/kmap.conf" ]; then
20 # Load keymap with Busybox loadkmap.
21 . /etc/kmap.conf
22 echo -n "Loading keymap: $KMAP... "
23 busybox loadkmap < /usr/share/kmap/$KMAP
24 status
25 else
26 tazkmap
27 fi
29 # Timezone config. Set timezone using the keymap config for fr, be, fr_CH
30 # and ca with Montreal.
31 #
32 if [ ! -f "/etc/TZ" ]; then
33 . /etc/kmap.conf
34 case "$KMAP" in
35 fr.kmap|be.kmap)
36 echo -n "Setting time zone to Europe/Paris... "
37 echo "Europe/Paris" > /etc/TZ && status
38 ;;
39 fr_CH.kmap)
40 echo -n "Setting time zone to Europe/Zurich... "
41 echo "Europe/Zurich" > /etc/TZ && status
42 ;;
43 ca.kmap)
44 echo -n "Setting time zone to America/Montreal... "
45 echo "America/Montreal" > /etc/TZ && status
46 ;;
47 *)
48 echo -n "Setting default time zone to UTC... "
49 echo "UTC" > /etc/TZ && status
50 ;;
51 esac
52 fi
54 # Firefox hack to get the right locale.
55 #
56 if grep -q "fr_*" /etc/locale.conf; then
57 # But is the fox installed ?
58 if [ -f "/var/lib/tazpkg/installed/firefox/receipt" ]; then
59 . /var/lib/tazpkg/installed/firefox/receipt
60 sed -i 's/en-US/fr/' \
61 /usr/lib/firefox-$VERSION/defaults/pref/firefox-l10n.js
62 fi
63 fi
65 # Gen a motd in french if fr_* or in English by default.
66 #
67 if [ ! -f "/etc/motd" ]; then
68 if grep -q "fr_*" /etc/locale.conf; then
69 # FR
70 cat > /etc/motd << "EOF"
73 (°- { La documentation est dans /usr/share/doc. Utiliser 'less -EM' pour,
74 //\ lire des fichiers et 'clex' pour les gérer, devenir root avec 'su',
75 v_/_ éditer avec 'nano'. Taper 'startx' pour lancer une session X. }
77 SliTaz GNU/Linux est distribuée dans l'espoir qu'elle sera utile, mais
78 alors SANS AUCUNE GARANTIE.
81 EOF
82 else
83 # EN
84 cat > /etc/motd << "EOF"
87 (°- { Get documentation in /usr/share/doc. Use 'less -EM' to read files,
88 //\ become root with 'su', manage files with 'clex', edit using 'nano'.
89 v_/_ Type 'startx' to start a X window session. }
91 SliTaz GNU/Linux is distributed in the hope that it will be useful, but
92 with ABSOLUTELY NO WARRANTY.
95 EOF
97 fi
99 fi