slitaz-boot-scripts 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 | 5ef45b38e0e5 |
children | e860c8bd2c57 |
files | etc/init.d/i18n.sh |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/etc/init.d/i18n.sh Fri Nov 30 12:31:59 2007 +0100 1.3 @@ -0,0 +1,99 @@ 1.4 +#!/bin/sh 1.5 +# /etc/init.d/i18n.sh - Internalisation initialisation. 1.6 +# This script configure SliTaz default keymap, locale and timezone. 1.7 +# 1.8 +. /etc/init.d/rc.functions 1.9 + 1.10 +# Locale config. 1.11 +# 1.12 +echo "Cheking if /etc/locale.conf exist... " 1.13 +if [ -f "/etc/locale.conf" ]; then 1.14 + echo -n "Locale configuration file exist... " 1.15 + status 1.16 +else 1.17 + tazlocale 1.18 +fi 1.19 + 1.20 +# Keymap config. 1.21 +# 1.22 +if [ -f "/etc/kmap.conf" ]; then 1.23 + # Load keymap with Busybox loadkmap. 1.24 + . /etc/kmap.conf 1.25 + echo -n "Loading keymap: $KMAP... " 1.26 + busybox loadkmap < /usr/share/kmap/$KMAP 1.27 + status 1.28 +else 1.29 + tazkmap 1.30 +fi 1.31 + 1.32 +# Timezone config. Set timezone using the keymap config for fr, be, fr_CH 1.33 +# and ca with Montreal. 1.34 +# 1.35 +if [ ! -f "/etc/TZ" ]; then 1.36 + . /etc/kmap.conf 1.37 + case "$KMAP" in 1.38 + fr.kmap|be.kmap) 1.39 + echo -n "Setting time zone to Europe/Paris... " 1.40 + echo "Europe/Paris" > /etc/TZ && status 1.41 + ;; 1.42 + fr_CH.kmap) 1.43 + echo -n "Setting time zone to Europe/Zurich... " 1.44 + echo "Europe/Zurich" > /etc/TZ && status 1.45 + ;; 1.46 + ca.kmap) 1.47 + echo -n "Setting time zone to America/Montreal... " 1.48 + echo "America/Montreal" > /etc/TZ && status 1.49 + ;; 1.50 + *) 1.51 + echo -n "Setting default time zone to UTC... " 1.52 + echo "UTC" > /etc/TZ && status 1.53 + ;; 1.54 + esac 1.55 +fi 1.56 + 1.57 +# Firefox hack to get the right locale. 1.58 +# 1.59 +if grep -q "fr_*" /etc/locale.conf; then 1.60 + # But is the fox installed ? 1.61 + if [ -f "/var/lib/tazpkg/installed/firefox/receipt" ]; then 1.62 + . /var/lib/tazpkg/installed/firefox/receipt 1.63 + sed -i 's/en-US/fr/' \ 1.64 + /usr/lib/firefox-$VERSION/defaults/pref/firefox-l10n.js 1.65 + fi 1.66 +fi 1.67 + 1.68 +# Gen a motd in french if fr_* or in English by default. 1.69 +# 1.70 +if [ ! -f "/etc/motd" ]; then 1.71 +if grep -q "fr_*" /etc/locale.conf; then 1.72 + # FR 1.73 + cat > /etc/motd << "EOF" 1.74 + 1.75 + 1.76 + (°- { La documentation est dans /usr/share/doc. Utiliser 'less -EM' pour, 1.77 + //\ lire des fichiers et 'clex' pour les gérer, devenir root avec 'su', 1.78 + v_/_ éditer avec 'nano'. Taper 'startx' pour lancer une session X. } 1.79 + 1.80 + SliTaz GNU/Linux est distribuée dans l'espoir qu'elle sera utile, mais 1.81 + alors SANS AUCUNE GARANTIE. 1.82 + 1.83 + 1.84 +EOF 1.85 + else 1.86 + # EN 1.87 + cat > /etc/motd << "EOF" 1.88 + 1.89 + 1.90 + (°- { Get documentation in /usr/share/doc. Use 'less -EM' to read files, 1.91 + //\ become root with 'su', manage files with 'clex', edit using 'nano'. 1.92 + v_/_ Type 'startx' to start a X window session. } 1.93 + 1.94 + SliTaz GNU/Linux is distributed in the hope that it will be useful, but 1.95 + with ABSOLUTELY NO WARRANTY. 1.96 + 1.97 + 1.98 +EOF 1.99 + 1.100 + fi 1.101 + 1.102 +fi