[or-cvs] r16283: Fixed some issues with setting KEYMAP, CONSOLEFONT and CONSO (incognito/trunk/root_overlay/etc/init.d)

anonym at seul.org anonym at seul.org
Thu Jul 31 06:43:40 UTC 2008


Author: anonym
Date: 2008-07-31 02:43:40 -0400 (Thu, 31 Jul 2008)
New Revision: 16283

Modified:
   incognito/trunk/root_overlay/etc/init.d/external-locale
Log:
Fixed some issues with setting KEYMAP, CONSOLEFONT and CONSOLETRANSLATION during init.


Modified: incognito/trunk/root_overlay/etc/init.d/external-locale
===================================================================
--- incognito/trunk/root_overlay/etc/init.d/external-locale	2008-07-31 06:42:56 UTC (rev 16282)
+++ incognito/trunk/root_overlay/etc/init.d/external-locale	2008-07-31 06:43:40 UTC (rev 16283)
@@ -12,7 +12,7 @@
 	if [[ "${TMP}" == "lang" && -n "${LANGUAGE}" ]]; then
 	    ebegin "Setting locale to ${LANGUAGE}"
 
-	    LOCALE=$(grep -m 1 -o -e "^${LANGUAGE}.*\.UTF-8" /etc/locale.gen)
+	    local LOCALE=$(grep -m 1 -o -e "^${LANGUAGE}.*\.UTF-8" /etc/locale.gen)
 
 	    cat > /etc/env.d/02locale <<EOF
 LANGUAGE="${LOCALE}"
@@ -22,7 +22,7 @@
 	    /sbin/env-update.sh > /dev/null
 
 	    # Localize mozilla
-	    MOZILLA_FIVE_HOME="/opt/firefox"
+	    local MOZILLA_FIVE_HOME="/opt/firefox"
 	    if [[ -w "${MOZILLA_FIVE_HOME}"/defaults/pref/firefox.js ]]; then
 		sed -i "s:general.useragent.locale\", \".*\":general.useragent.locale\", \"${LANGUAGE}\":" \
 		    "${MOZILLA_FIVE_HOME}"/defaults/pref/firefox.js \
@@ -35,18 +35,18 @@
 
 	    # Set keyboard layout in KDE
 	    case "${LANGUAGE}" in
-		"ar") XKB_LANG="ara";;
-		"el") XKB_LANG="gr";;
-		"en") XKB_LANG="us";;
-		"fa") XKB_LANG="ir";;
-		"he") XKB_LANG="il";;
-                "ja") XKB_LANG="jp";;
-                "sv") XKB_LANG="se";;
-                "zh") XKB_LANG="cn";;
-		*) XKB_LANG="${LANGUAGE}";;
+		"ar") XKB_LANG="ara" ;;
+		"el") XKB_LANG="gr" ;;
+		"en") XKB_LANG="us" ;;
+		"fa") XKB_LANG="ir" ;;
+		"he") XKB_LANG="il" ;;
+                "ja") XKB_LANG="jp" ;;
+                "sv") XKB_LANG="se" ;;
+                "zh") XKB_LANG="cn" ;;
+		*) XKB_LANG="${LANGUAGE}" ;;
 	    esac
 
-	    KXKBRC="/home/__INCOGNITO_USER__/.kde/share/config/kxkbrc"
+	    local KXKBRC="/home/__INCOGNITO_USER__/.kde/share/config/kxkbrc"
 	    if [[ -w "${KXKBRC}" ]]; then
 		sed -i "s:=${XKB_LANG},\?:=:" "${KXKBRC}"
 		sed -i "s:,${XKB_LANG}::" "${KXKBRC}"
@@ -55,16 +55,93 @@
 
 	    eend 0
 	fi
-	if [[ "${TMP}" == "keymap" && -n "${LANGUAGE}" && ! -e "/etc/sysconfig/keyboard" ]]; then
-			# Missing /etc/sysconfig/keyboard implies initramfs script did not set a keymap
-	    mkdir -p /etc/sysconfig
-	    echo "XKEYBOARD=${LANGUAGE}" > /etc/sysconfig/keyboard
-	    sed -i "s/KEYMAP=\"us\"/KEYMAP=\"${LANGUAGE}\"/" /etc/conf.d/keymaps
+	if [[ "${TMP}" == "keymap" && -n "${LANGUAGE}" ]]; then
+	    # Missing /etc/sysconfig/keyboard implies initramfs script did
+	    # not set a keymap
+	    if [ ! -e "/etc/sysconfig/keyboard" ]; then
+		mkdir -p /etc/sysconfig
+		echo "XKEYBOARD=${LANGUAGE}" > /etc/sysconfig/keyboard		
+	    fi
+
+	    # Set console keymap and font
+	    local KEYMAP=""
+	    local CFONT=""
+	    local CTRANS=""
+	    case "${LANGUAGE}" in
+                "us")
+		    KEYMAP="us"
+		    CFONT="default8x16"
+		    ;;
+		"fr")
+		    KEYMAP="fr-latin9"
+		    CFONT="lat0-16"
+		    ;;
+		"de")
+		    KEYMAP="de-latin1"
+		    CFONT="lat0-16"
+		    ;;
+		"gr")
+		    KEYMAP="-u gr"
+		    CFONT="iso07u-16"
+		    ;;
+		"il")
+		    KEYMAP="il"
+		    CFONT="iso08.08"
+		    CTRANS="8859-8_to_uni"
+		    ;;
+		"it")
+		    KEYMAP="it"
+		    CFONT="default8x16"
+		    CTRANS="8859-15_to_uni"
+		    ;;
+		"jp")
+		    KEYMAP="jp106"
+		    ;;
+		"pt")
+		    KEYMAP="pt-latin1"
+		    CFONT="lat0-16"
+		    ;;
+		"ru")
+		    KEYMAP="-u ru"
+		    CFONT="Cyr_a8x16"
+		    CTRANS="cp866_to_uni"
+		    ;;
+		"se")
+		    KEYMAP="sv-latin1"
+		    CFONT="lat9-16"
+		    ;;
+		"es")
+		    KEYMAP="es euro2"
+		    CFONT="lat0-16"
+		    ;;
+		*)  
+		    # For the others (like Chinese) it seems we can do nothing.
+		    ;;
+	    esac
+
+	    if [ -n "${KEYMAP}" ]; then
+		sed -i "s/KEYMAP=\".*\"/KEYMAP=\"${KEYMAP}\"/" \
+		    /etc/conf.d/keymaps
+	    fi
+
+	    if [ -n "${CFONT}" ]; then
+		sed -i "s/CONSOLEFONT=\".*\"/CONSOLEFONT=\"${CFONT}\"/" \
+		    /etc/conf.d/consolefont
+	    fi
+	    
+	    if [ -n "${CTRANS}" ]; then
+		sed -i "s/#CONSOLETRANSLATION=\".*\"/CONSOLETRANSLATION=\"${CTRANS}\"/" \
+		    /etc/conf.d/consolefont
+	    fi
+
 	fi
     done
+
     if [[ -e "/etc/sysconfig/keyboard" ]]; then
 	source /etc/sysconfig/keyboard
-	[[ -n "${XKEYBOARD}" ]] && sed -i "s/KEYMAP=\".*\"/KEYMAP=\"${XKEYBOARD}\"/" /etc/conf.d/keymaps
     fi
-    [[ -f "/etc/env.d/02locale" ]] && source /etc/env.d/02locale
+
+    if [[ -f "/etc/env.d/02locale" ]]; then
+	source /etc/env.d/02locale
+    fi
 }



More information about the tor-commits mailing list