teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0221-test-add-one-more-path-to-search-keymaps.patch

594167
From 380a3b2b2d38f08ac84d3ac521b205960059d99c Mon Sep 17 00:00:00 2001
594167
From: Yu Watanabe <watanabe.yu+github@gmail.com>
594167
Date: Tue, 14 Jun 2022 09:10:00 +0900
594167
Subject: [PATCH] test: add one more path to search keymaps
594167
594167
Now it also supports split-usr.
594167
594167
(cherry picked from commit 569c6fd1b7c7946fa853d558fcbb23e4a45f957f)
594167
594167
Related: #2087652
594167
---
594167
 test/test-functions | 59 ++++++++++++++++++++++++++++++---------------
594167
 1 file changed, 40 insertions(+), 19 deletions(-)
594167
594167
diff --git a/test/test-functions b/test/test-functions
594167
index d71e2a3328..01fc90fbf5 100644
594167
--- a/test/test-functions
594167
+++ b/test/test-functions
594167
@@ -1844,26 +1844,47 @@ install_pam() {
594167
 
594167
 # shellcheck disable=SC2120
594167
 install_keymaps() {
594167
-    dinfo "Install keymaps"
594167
-    # The first three paths may be deprecated.
594167
-    # It seems now the last two paths are used by many distributions.
594167
-    for i in \
594167
-        /usr/lib/kbd/keymaps/include/* \
594167
-        /usr/lib/kbd/keymaps/i386/include/* \
594167
-        /usr/lib/kbd/keymaps/i386/qwerty/us.* \
594167
-        /usr/lib/kbd/keymaps/legacy/include/* \
594167
-        /usr/lib/kbd/keymaps/legacy/i386/qwerty/us.*; do
594167
-            [[ -f "$i" ]] || continue
594167
-            inst "$i"
594167
-    done
594167
+    local i p
594167
+    local -a prefix=(
594167
+        "/usr"
594167
+    )
594167
 
594167
-    # When it takes any argument, then install more keymaps.
594167
-    if [[ $# -gt 1 ]]; then
594167
-        for i in \
594167
-        /usr/lib/kbd/keymaps/i386/*/* \
594167
-        /usr/lib/kbd/keymaps/legacy/i386/*/*; do
594167
-            [[ -f "$i" ]] || continue
594167
-            inst "$i"
594167
+    dinfo "Install console keymaps"
594167
+
594167
+    if command -v meson >/dev/null \
594167
+            && [[ "$(meson configure "${BUILD_DIR:?}" | grep 'split-usr' | awk '{ print $2 }')" == "true" ]] \
594167
+            || [[ ! -L /lib ]]; then
594167
+        prefix+=(
594167
+            ""
594167
+        )
594167
+    fi
594167
+
594167
+    if (( $# == 0 )); then
594167
+        for p in "${prefix[@]}"; do
594167
+            # The first three paths may be deprecated.
594167
+            # It seems now the last three paths are used by many distributions.
594167
+            for i in \
594167
+                "$p"/lib/kbd/keymaps/include/* \
594167
+                "$p"/lib/kbd/keymaps/i386/include/* \
594167
+                "$p"/lib/kbd/keymaps/i386/qwerty/us.* \
594167
+                "$p"/lib/kbd/keymaps/legacy/include/* \
594167
+                "$p"/lib/kbd/keymaps/legacy/i386/qwerty/us.* \
594167
+                "$p"/lib/kbd/keymaps/xkb/us*; do
594167
+                    [[ -f "$i" ]] || continue
594167
+                    inst "$i"
594167
+            done
594167
+        done
594167
+    else
594167
+        # When it takes any argument, then install more keymaps.
594167
+        for p in "${prefix[@]}"; do
594167
+            for i in \
594167
+                "$p"/lib/kbd/keymaps/include/* \
594167
+                "$p"/lib/kbd/keymaps/i386/*/* \
594167
+                "$p"/lib/kbd/keymaps/legacy/i386/*/* \
594167
+                "$p"/lib/kbd/keymaps/xkb/*; do
594167
+                    [[ -f "$i" ]] || continue
594167
+                    inst "$i"
594167
+            done
594167
         done
594167
     fi
594167
 }