Harald Hoyer b3dfe7
From 1ec2e34adcec7ee17fbf5e0410fd21cd1f2c9e27 Mon Sep 17 00:00:00 2001
Harald Hoyer b3dfe7
From: Harald Hoyer <harald@hoyer.xyz>
Harald Hoyer b3dfe7
Date: Mon, 6 Nov 2017 09:56:13 +0100
Harald Hoyer b3dfe7
Subject: [PATCH] Merge pull request #300 from danimo/pick_all_matching_keymaps
Harald Hoyer b3dfe7
Harald Hoyer b3dfe7
10i18n: Load all keymaps for a given locale
Harald Hoyer b3dfe7
---
Harald Hoyer b3dfe7
 modules.d/10i18n/module-setup.sh | 35 ++++++++++++++++++++---------------
Harald Hoyer b3dfe7
 1 file changed, 20 insertions(+), 15 deletions(-)
Harald Hoyer b3dfe7
Harald Hoyer b3dfe7
diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh
Harald Hoyer b3dfe7
index 62babb2b..7723f6fa 100755
Harald Hoyer b3dfe7
--- a/modules.d/10i18n/module-setup.sh
Harald Hoyer b3dfe7
+++ b/modules.d/10i18n/module-setup.sh
Harald Hoyer b3dfe7
@@ -29,21 +29,24 @@ install() {
Harald Hoyer b3dfe7
 
Harald Hoyer b3dfe7
     # This is from 10redhat-i18n.
Harald Hoyer b3dfe7
     findkeymap () {
Harald Hoyer b3dfe7
-        local MAP=$1
Harald Hoyer b3dfe7
+        local MAPS=$1
Harald Hoyer b3dfe7
         local MAPNAME=${1%.map*}
Harald Hoyer b3dfe7
-        [[ ! -f $MAP ]] && \
Harald Hoyer b3dfe7
-            MAP=$(find ${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\* | head -n1)
Harald Hoyer b3dfe7
-        [[ " $KEYMAPS " = *" $MAP "* ]] && return
Harald Hoyer b3dfe7
-        KEYMAPS="$KEYMAPS $MAP"
Harald Hoyer b3dfe7
-        case $MAP in
Harald Hoyer b3dfe7
-            *.gz) cmd=zgrep;;
Harald Hoyer b3dfe7
-            *.bz2) cmd=bzgrep;;
Harald Hoyer b3dfe7
-            *) cmd=grep ;;
Harald Hoyer b3dfe7
-        esac
Harald Hoyer b3dfe7
-
Harald Hoyer b3dfe7
-        for INCL in $($cmd "^include " $MAP | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
Harald Hoyer b3dfe7
-            for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
Harald Hoyer b3dfe7
-                findkeymap $FN
Harald Hoyer b3dfe7
+        local map
Harald Hoyer b3dfe7
+        [[ ! -f $MAPS ]] && \
Harald Hoyer b3dfe7
+            MAPS=$(find ${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\*)
Harald Hoyer b3dfe7
+
Harald Hoyer b3dfe7
+        for map in $MAPS; do
Harald Hoyer b3dfe7
+            KEYMAPS="$KEYMAPS $map"
Harald Hoyer b3dfe7
+            case $map in
Harald Hoyer b3dfe7
+                *.gz) cmd=zgrep;;
Harald Hoyer b3dfe7
+                *.bz2) cmd=bzgrep;;
Harald Hoyer b3dfe7
+                *) cmd=grep ;;
Harald Hoyer b3dfe7
+            esac
Harald Hoyer b3dfe7
+
Harald Hoyer b3dfe7
+            for INCL in $($cmd "^include " $map | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
Harald Hoyer b3dfe7
+                for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
Harald Hoyer b3dfe7
+                    findkeymap $FN
Harald Hoyer b3dfe7
+                done
Harald Hoyer b3dfe7
             done
Harald Hoyer b3dfe7
         done
Harald Hoyer b3dfe7
     }
Harald Hoyer b3dfe7
@@ -191,7 +194,9 @@ install() {
Harald Hoyer b3dfe7
             findkeymap ${map}
Harald Hoyer b3dfe7
         done
Harald Hoyer b3dfe7
 
Harald Hoyer b3dfe7
-        inst_opt_decompress ${KEYMAPS}
Harald Hoyer b3dfe7
+        for keymap in ${KEYMAPS}; do
Harald Hoyer b3dfe7
+            inst_opt_decompress ${keymap}
Harald Hoyer b3dfe7
+        done
Harald Hoyer b3dfe7
 
Harald Hoyer b3dfe7
         inst_opt_decompress ${kbddir}/consolefonts/${DEFAULT_FONT}.*
Harald Hoyer b3dfe7
 
Harald Hoyer d88ded