File 0569-10i18n-Load-all-keymaps-for-a-given-locale.patch of Package dracut.9139

From afd09c9a87ef09e2595f71fdae1d38ac00cfd071 Mon Sep 17 00:00:00 2001
From: Daniel Molkentin <dmolkentin@suse.com>
Date: Thu, 26 Oct 2017 14:59:34 +0200
Subject: [PATCH 1/2] 10i18n: Load all keymaps for a given locale

Previously, dracut would only copy the first one found. However,
with legacy maps for some locales around, there is a chance we
pick the wrong one. Pick all matching keymaps instead

Reference: boo#1065058
---
 modules.d/10i18n/module-setup.sh | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh
index d6aab19f..be4ada54 100755
--- a/modules.d/10i18n/module-setup.sh
+++ b/modules.d/10i18n/module-setup.sh
@@ -30,21 +30,24 @@ install() {
 
     # This is from 10redhat-i18n.
     findkeymap () {
-        local MAP=$1
+        local MAPS=$1
         local MAPNAME=${1%.map*}
-        [[ ! -f $MAP ]] && \
-            MAP=$(find ${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\* | head -n1)
-        [[ " $KEYMAPS " = *" $MAP "* ]] && return
-        KEYMAPS="$KEYMAPS $MAP"
-        case $MAP in
-            *.gz) cmd=zgrep;;
-            *.bz2) cmd=bzgrep;;
-            *) cmd=grep ;;
-        esac
-
-        for INCL in $($cmd "^include " $MAP | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
-            for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
-                findkeymap $FN
+        local map
+        [[ ! -f $MAPS ]] && \
+            MAPS=$(find ${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\*)
+
+        for map in $MAPS; do
+            KEYMAPS="$KEYMAPS $map"
+            case $map in
+                *.gz) cmd=zgrep;;
+                *.bz2) cmd=bzgrep;;
+                *) cmd=grep ;;
+            esac
+
+            for INCL in $($cmd "^include " $map | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
+                for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
+                    findkeymap $FN
+                done
             done
         done
     }
@@ -185,7 +188,9 @@ install() {
             findkeymap ${map}
         done
 
-        inst_opt_decompress ${KEYMAPS}
+        for keymap in ${KEYMAPS}; do
+            inst_opt_decompress ${keymap}
+        done
 
         inst_opt_decompress ${kbddir}/consolefonts/${DEFAULT_FONT}.*
 
-- 
2.16.3

openSUSE Build Service is sponsored by