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

Use loadkeys and tazkeymap to configure keyboard layout
author Christophe Lincoln <pankso@slitaz.org>
date Fri May 02 21:31:22 2008 +0200 (2008-05-02)
parents 1ceb004d3c43
children 1ba89cc0b7bc
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... "
22 loadkeys $KEYMAP
23 else
24 tazkeymap
25 fi
27 # Timezone config. Set timezone using the keymap config for fr, be, fr_CH
28 # and ca with Montreal.
29 #
30 if [ ! -f "/etc/TZ" ]; then
31 KEYMAP=`cat /etc/keymap.conf`
32 case "$KEYMAP" in
33 fr-latin1|be-latin1)
34 echo -n "Setting time zone to Europe/Paris... "
35 echo "Europe/Paris" > /etc/TZ && status
36 ;;
37 fr_CH-latin1|de_CH-latin1)
38 echo -n "Setting time zone to Europe/Zurich... "
39 echo "Europe/Zurich" > /etc/TZ && status
40 ;;
41 cf)
42 echo -n "Setting time zone to America/Montreal... "
43 echo "America/Montreal" > /etc/TZ && status
44 ;;
45 *)
46 echo -n "Setting default time zone to UTC... "
47 echo "UTC" > /etc/TZ && status
48 ;;
49 esac
50 fi
52 # Firefox hack to get the right locale.
53 #
54 if grep -q "fr_*" /etc/locale.conf; then
55 # But is the fox installed ?
56 if [ -f "/var/lib/tazpkg/installed/firefox/receipt" ]; then
57 . /var/lib/tazpkg/installed/firefox/receipt
58 sed -i 's/en-US/fr/' \
59 /usr/lib/firefox-$VERSION/defaults/pref/firefox-l10n.js
60 fi
61 fi
63 # Gen a motd in french if fr_* or in English by default.
64 #
65 if [ ! -f "/etc/motd" ]; then
66 if grep -q "fr_*" /etc/locale.conf; then
67 # FR
68 cat > /etc/motd << "EOF"
71 (°- { La documentation est dans /usr/share/doc. Utiliser 'less -EM' pour,
72 //\ lire des fichiers et 'clex' pour les gérer, devenir root avec 'su',
73 v_/_ éditer avec 'nano'. Taper 'startx' pour lancer une session X. }
75 SliTaz GNU/Linux est distribuée dans l'espoir qu'elle sera utile, mais
76 alors SANS AUCUNE GARANTIE.
79 EOF
80 else
81 # EN
82 cat > /etc/motd << "EOF"
85 (°- { Get documentation in /usr/share/doc. Use 'less -EM' to read files,
86 //\ become root with 'su', manage files with 'clex', edit using 'nano'.
87 v_/_ Type 'startx' to start a X window session. }
89 SliTaz GNU/Linux is distributed in the hope that it will be useful, but
90 with ABSOLUTELY NO WARRANTY.
93 EOF
95 fi
97 fi