From 25fbcc55e18471f01bd4cd8765fbf5b3c8754e9d Mon Sep 17 00:00:00 2001 From: Antonio Alvarez Feijoo Date: Wed, 7 Feb 2024 11:48:57 +0100 Subject: [PATCH 1/2] fix(i18n): handle keymap includes with `--sysroot` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The results of `find "${dracutsysrootdir}${kbddir}"/keymaps/ -type f -name "${INCL}*" -print0` are directly passed to `findkeymap` containing the `$dracutsysrootdir` path, which causes that `[[ -f $dracutsysrootdir$1 ]]` evaluates to false because the same path is prepended again, and the following `find` fails because `MAPNAME` has an absolute path. E.g., with `dracutsysrootdir=/.snapshots/9/snapshot`, for `MAPNAME=us` the `INCLUDES` of `MAP=/.snapshots/9/snapshot/usr/share/kbd/keymaps/i386/qwerty/us.map.gz` will pass `/.snapshots/9/snapshot/usr/share/kbd/keymaps/i386/include/qwerty-layout.inc` to `findkeymap`. ``` dracut[I]: *** Including module: i18n *** find: warning: ‘-name’ matches against basenames only, but the given pattern contains a directory separator (‘/’), thus the expression will evaluate to false all the time. Did you mean ‘-wholename’? ``` --- modules.d/10i18n/module-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh index ac456112fc..4a465b0e42 100755 --- a/modules.d/10i18n/module-setup.sh +++ b/modules.d/10i18n/module-setup.sh @@ -38,7 +38,7 @@ install() { local CMD local FN - if [[ -f $dracutsysrootdir$1 ]]; then + if [[ -f $1 ]]; then MAPS=("$1") else MAPNAME=${1%.map*} From c3c4186b9488d2db712716f03efcdd71601ddfe8 Mon Sep 17 00:00:00 2001 From: Antonio Alvarez Feijoo Date: Wed, 7 Feb 2024 11:49:14 +0100 Subject: [PATCH 2/2] fix(dracut-init.sh): handle decompress with `--sysroot` Remove `$dracutsysrootdir` from the file path passed to the decompress command, otherwise the path is wrong and the file is not decompressed in the temporary directory where the initramfs is being built. E.g.: ``` dracut[I]: *** Including module: i18n *** gzip: /var/tmp/dracut.6Iqygd/initramfs/.snapshots/12/snapshot/usr/share/kbd/keymaps/i386/include/euro1.map.gz: No such file or directory gzip: /var/tmp/dracut.6Iqygd/initramfs/.snapshots/12/snapshot/usr/share/kbd/keymaps/i386/qwerty/us.map.gz: No such file or directory gzip: /var/tmp/dracut.6Iqygd/initramfs/.snapshots/12/snapshot/usr/share/kbd/keymaps/xkb/us.map.gz: No such file or directory ``` --- dracut-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dracut-init.sh b/dracut-init.sh index 6b81833260..a427f0a696 100755 --- a/dracut-init.sh +++ b/dracut-init.sh @@ -730,7 +730,7 @@ inst_decompress() { inst_simple "${_src}" # Decompress with chosen tool. We assume that tool changes name e.g. # from 'name.gz' to 'name'. - ${_cmd} "${initdir}${_src}" + ${_cmd} "${initdir}${_src#"$dracutsysrootdir"}" done }