Harald Hoyer 3957aa
From 95023eb325f899303deaaee7c53d83a41f942340 Mon Sep 17 00:00:00 2001
Harald Hoyer 3957aa
From: Colin Guthrie <colin@mageia.org>
Harald Hoyer 3957aa
Date: Wed, 30 Nov 2011 22:21:24 +0000
Harald Hoyer 3957aa
Subject: [PATCH] Fix Unicode keytable.
Harald Hoyer 3957aa
Harald Hoyer 3957aa
This patch was originally from Mandriva: dracut-013-fix_unicode_keytable.patch
Harald Hoyer 3957aa
---
Harald Hoyer 3957aa
 modules.d/10i18n/README          |    2 +
Harald Hoyer 3957aa
 modules.d/10i18n/module-setup.sh |   49 +++++++++++++++++++++++--------------
Harald Hoyer 3957aa
 2 files changed, 32 insertions(+), 19 deletions(-)
Harald Hoyer 3957aa
Harald Hoyer 3957aa
diff --git a/modules.d/10i18n/README b/modules.d/10i18n/README
Harald Hoyer 3957aa
index 0507a47..89339aa 100644
Harald Hoyer 3957aa
--- a/modules.d/10i18n/README
Harald Hoyer 3957aa
+++ b/modules.d/10i18n/README
Harald Hoyer 3957aa
@@ -47,6 +47,8 @@ The following variables are used by i18n install script and at initramfs
Harald Hoyer 3957aa
 runtime:
Harald Hoyer 3957aa
 
Harald Hoyer 3957aa
     KEYMAP - keyboard translation table loaded by loadkeys
Harald Hoyer 3957aa
+    KEYTABLE - base name for keyboard translation table; if UNICODE is
Harald Hoyer 3957aa
+    true, Unicode version will be loaded. Overrides KEYMAP.
Harald Hoyer 3957aa
     EXT_KEYMAPS - list of extra keymaps to bo loaded (sep. by space)
Harald Hoyer 3957aa
     UNICODE - boolean, indicating UTF-8 mode
Harald Hoyer 3957aa
     FONT - console font
Harald Hoyer 3957aa
diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh
Harald Hoyer 3957aa
index 6248607..8342fb4 100755
Harald Hoyer 3957aa
--- a/modules.d/10i18n/module-setup.sh
Harald Hoyer 3957aa
+++ b/modules.d/10i18n/module-setup.sh
Harald Hoyer 3957aa
@@ -110,8 +110,38 @@ install() {
Harald Hoyer 3957aa
         [ -f $I18N_CONF ] && . $I18N_CONF
Harald Hoyer 3957aa
         [ -f $VCONFIG_CONF ] && . $VCONFIG_CONF
Harald Hoyer 3957aa
 
Harald Hoyer 3957aa
+        shopt -q -s nocasematch
Harald Hoyer 3957aa
+        if [[ ${UNICODE} ]]
Harald Hoyer 3957aa
+        then
Harald Hoyer 3957aa
+            if [[ ${UNICODE} = YES || ${UNICODE} = 1 ]]
Harald Hoyer 3957aa
+            then
Harald Hoyer 3957aa
+                UNICODE=1
Harald Hoyer 3957aa
+            elif [[ ${UNICODE} = NO || ${UNICODE} = 0 ]]
Harald Hoyer 3957aa
+            then
Harald Hoyer 3957aa
+                UNICODE=0
Harald Hoyer 3957aa
+            else
Harald Hoyer 3957aa
+                UNICODE=''
Harald Hoyer 3957aa
+            fi
Harald Hoyer 3957aa
+        fi
Harald Hoyer 3957aa
+        if [[ ! ${UNICODE} && ${LANG} =~ .*\.UTF-?8 ]]
Harald Hoyer 3957aa
+        then
Harald Hoyer 3957aa
+            UNICODE=1
Harald Hoyer 3957aa
+        fi
Harald Hoyer 3957aa
+        shopt -q -u nocasematch
Harald Hoyer 3957aa
+
Harald Hoyer 3957aa
         # Gentoo user may have KEYMAP set to something like "-u pl2",
Harald Hoyer 3957aa
         KEYMAP=${KEYMAP#-* }
Harald Hoyer 3957aa
+
Harald Hoyer 3957aa
+        # KEYTABLE is a bit special - it defines base keymap name and UNICODE
Harald Hoyer 3957aa
+        # determines whether non-UNICODE or UNICODE version is used
Harald Hoyer 3957aa
+
Harald Hoyer 3957aa
+        if [[ ${KEYTABLE} ]]; then
Harald Hoyer 3957aa
+           if [[ ${UNICODE} == 1 ]]; then
Harald Hoyer 3957aa
+               [[ ${KEYTABLE} =~ .*\.uni.* ]] || KEYTABLE=${KEYTABLE%.map*}.uni
Harald Hoyer 3957aa
+           fi
Harald Hoyer 3957aa
+           KEYMAP=${KEYTABLE}
Harald Hoyer 3957aa
+        fi
Harald Hoyer 3957aa
+
Harald Hoyer 3957aa
         # I'm not sure of the purpose of UNIKEYMAP and GRP_TOGGLE.  They were in
Harald Hoyer 3957aa
         # original redhat-i18n module.  Anyway it won't hurt.
Harald Hoyer 3957aa
         EXT_KEYMAPS+=\ ${UNIKEYMAP}\ ${GRP_TOGGLE}
Harald Hoyer 3957aa
@@ -150,25 +180,6 @@ install() {
Harald Hoyer 3957aa
             inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
Harald Hoyer 3957aa
         fi
Harald Hoyer 3957aa
 
Harald Hoyer 3957aa
-        shopt -q -s nocasematch
Harald Hoyer 3957aa
-        if [[ ${UNICODE} ]]
Harald Hoyer 3957aa
-        then
Harald Hoyer 3957aa
-            if [[ ${UNICODE} = YES || ${UNICODE} = 1 ]]
Harald Hoyer 3957aa
-            then
Harald Hoyer 3957aa
-                UNICODE=1
Harald Hoyer 3957aa
-            elif [[ ${UNICODE} = NO || ${UNICODE} = 0 ]]
Harald Hoyer 3957aa
-            then
Harald Hoyer 3957aa
-                UNICODE=0
Harald Hoyer 3957aa
-            else
Harald Hoyer 3957aa
-                UNICODE=''
Harald Hoyer 3957aa
-            fi
Harald Hoyer 3957aa
-        fi
Harald Hoyer 3957aa
-        if [[ ! ${UNICODE} && ${LANG} =~ .*\.UTF-?8 ]]
Harald Hoyer 3957aa
-        then
Harald Hoyer 3957aa
-            UNICODE=1
Harald Hoyer 3957aa
-        fi
Harald Hoyer 3957aa
-        shopt -q -u nocasematch
Harald Hoyer 3957aa
-
Harald Hoyer 3957aa
         mksubdirs ${initdir}${I18N_CONF}
Harald Hoyer 3957aa
         mksubdirs ${initdir}${VCONFIG_CONF}
Harald Hoyer 3957aa
         print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}