]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(i18n): handle symlinked keymap
authorThomas Blume <Thomas.Blume@suse.com>
Mon, 22 Jan 2024 09:28:00 +0000 (10:28 +0100)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Sun, 31 Mar 2024 02:10:10 +0000 (22:10 -0400)
handle keymaps that are symlinks to others, for example:

KEYMAP=de-nodeadkeys in vconsole.conf is:

lrwxrwxrwx 1 root root 20 17. Mai 2023  /usr/share/kbd/keymaps/xkb/de-nodeadkeys.map.gz -> at-nodeadkeys.map.gz

modules.d/10i18n/module-setup.sh

index ac456112fc288ef3cd2000cd8795411940c145f5..ffd2f2c554dbd7865e57947df5994372a5d4e9b6 100755 (executable)
@@ -44,7 +44,7 @@ install() {
             MAPNAME=${1%.map*}
 
             mapfile -t -d '' MAPS < <(
-                find "${dracutsysrootdir}${kbddir}"/keymaps/ -type f \( -name "${MAPNAME}" -o -name "${MAPNAME}.map*" \) -print0
+                find "${dracutsysrootdir}${kbddir}"/keymaps/ -type f,l \( -name "${MAPNAME}" -o -name "${MAPNAME}.map*" \) -print0
             )
         fi
 
@@ -160,6 +160,7 @@ install() {
 
     install_local_i18n() {
         local map
+        local maplink
 
         # shellcheck disable=SC2086
         eval "$(gather_vars ${i18n_vars})"
@@ -216,7 +217,19 @@ install() {
         done
 
         for keymap in "${!KEYMAPS[@]}"; do
-            inst_opt_decompress "${keymap}"
+            if [[ -L ${keymap} ]]; then
+                maplink=$(readlink -f "${keymap}")
+                # skip symlinked directories
+                [[ -d ${maplink} ]] && continue
+
+                inst_opt_decompress "${maplink}"
+                # create new symlink to decompressed keymap
+                maplink=${maplink%.gz}
+                keymap=${keymap%.gz}
+                ln -srn "${initdir}${maplink#"$dracutsysrootdir"}" "${initdir}${keymap#"$dracutsysrootdir"}"
+            else
+                inst_opt_decompress "${keymap}"
+            fi
         done
 
         inst_opt_decompress "${kbddir}"/consolefonts/"${DEFAULT_FONT}".*