# HG changeset patch # User Christophe Lincoln # Date 1196422319 -3600 # Node ID 1ceb004d3c434651764a45e4a1886decd3954bfb # Parent 5ef45b38e0e536584cf4ff58b6f0d9777846f9be Add i18n.sh (config keymap, locale and TZ) diff -r 5ef45b38e0e5 -r 1ceb004d3c43 etc/init.d/i18n.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/etc/init.d/i18n.sh Fri Nov 30 12:31:59 2007 +0100 @@ -0,0 +1,99 @@ +#!/bin/sh +# /etc/init.d/i18n.sh - Internalisation initialisation. +# This script configure SliTaz default keymap, locale and timezone. +# +. /etc/init.d/rc.functions + +# Locale config. +# +echo "Cheking if /etc/locale.conf exist... " +if [ -f "/etc/locale.conf" ]; then + echo -n "Locale configuration file exist... " + status +else + tazlocale +fi + +# Keymap config. +# +if [ -f "/etc/kmap.conf" ]; then + # Load keymap with Busybox loadkmap. + . /etc/kmap.conf + echo -n "Loading keymap: $KMAP... " + busybox loadkmap < /usr/share/kmap/$KMAP + status +else + tazkmap +fi + +# Timezone config. Set timezone using the keymap config for fr, be, fr_CH +# and ca with Montreal. +# +if [ ! -f "/etc/TZ" ]; then + . /etc/kmap.conf + case "$KMAP" in + fr.kmap|be.kmap) + echo -n "Setting time zone to Europe/Paris... " + echo "Europe/Paris" > /etc/TZ && status + ;; + fr_CH.kmap) + echo -n "Setting time zone to Europe/Zurich... " + echo "Europe/Zurich" > /etc/TZ && status + ;; + ca.kmap) + echo -n "Setting time zone to America/Montreal... " + echo "America/Montreal" > /etc/TZ && status + ;; + *) + echo -n "Setting default time zone to UTC... " + echo "UTC" > /etc/TZ && status + ;; + esac +fi + +# Firefox hack to get the right locale. +# +if grep -q "fr_*" /etc/locale.conf; then + # But is the fox installed ? + if [ -f "/var/lib/tazpkg/installed/firefox/receipt" ]; then + . /var/lib/tazpkg/installed/firefox/receipt + sed -i 's/en-US/fr/' \ + /usr/lib/firefox-$VERSION/defaults/pref/firefox-l10n.js + fi +fi + +# Gen a motd in french if fr_* or in English by default. +# +if [ ! -f "/etc/motd" ]; then +if grep -q "fr_*" /etc/locale.conf; then + # FR + cat > /etc/motd << "EOF" + + + (°- { La documentation est dans /usr/share/doc. Utiliser 'less -EM' pour, + //\ lire des fichiers et 'clex' pour les gérer, devenir root avec 'su', + v_/_ éditer avec 'nano'. Taper 'startx' pour lancer une session X. } + + SliTaz GNU/Linux est distribuée dans l'espoir qu'elle sera utile, mais + alors SANS AUCUNE GARANTIE. + + +EOF + else + # EN + cat > /etc/motd << "EOF" + + + (°- { Get documentation in /usr/share/doc. Use 'less -EM' to read files, + //\ become root with 'su', manage files with 'clex', edit using 'nano'. + v_/_ Type 'startx' to start a X window session. } + + SliTaz GNU/Linux is distributed in the hope that it will be useful, but + with ABSOLUTELY NO WARRANTY. + + +EOF + + fi + +fi