dracut/backport-fix-shellcheck-for-modules.d-10i18n-module-setup.sh.patch
hongjinghao 2663ebded8 backport patchs from upstream
(cherry picked from commit e37aecb42764d47b923dd3280385bd5438f466b6)
2024-02-22 14:56:32 +08:00

65 lines
2.4 KiB
Diff

From aa05b741e3c0ca708a0e76445a9aa94b52bc1974 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 12 Feb 2021 13:26:10 +0100
Subject: [PATCH] fix: shellcheck for modules.d/10i18n/module-setup.sh
Conflict:NA
Reference:https://github.com/dracutdevs/dracut/commit/aa05b741e3c0ca708a0e76445a9aa94b52bc1974
---
modules.d/10i18n/module-setup.sh | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh
index dd45b666..04a402f1 100755
--- a/modules.d/10i18n/module-setup.sh
+++ b/modules.d/10i18n/module-setup.sh
@@ -19,7 +19,7 @@ install() {
if dracut_module_included "systemd"; then
unset FONT
unset KEYMAP
- [[ -f $dracutsysrootdir/etc/vconsole.conf ]] && . $dracutsysrootdir/etc/vconsole.conf
+ [[ -f "$dracutsysrootdir"/etc/vconsole.conf ]] && . "$dracutsysrootdir"/etc/vconsole.conf
fi
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
@@ -38,13 +38,14 @@ install() {
for map in $MAPS; do
KEYMAPS="$KEYMAPS $map "
case $map in
- *.gz) cmd=zgrep;;
- *.bz2) cmd=bzgrep;;
- *) cmd=grep ;;
+ *.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 INCL in $($cmd "^include " $map | while read _ a _ || [ -n "$a" ]; do echo ${a//\"/}; done); do
for FN in $(find $dracutsysrootdir${kbddir}/keymaps -type f -name $INCL\*); do
+ [[ -f $FN ]] || continue
strstr "$KEYMAPS" " $FN " || findkeymap $FN
done
done
@@ -81,6 +82,8 @@ install() {
gather_vars() {
local item map value
+ # FIXME: double check
+ # shellcheck disable=SC2068
for item in $@
do
item=(${item/:/ })
@@ -107,7 +110,7 @@ install() {
if [[ ${kbddir} != "/usr/share" ]]; then
inst_dir /usr/share
- for _src in $(eval echo {${KBDSUBDIRS}}); do
+ for _src in $(eval echo "{ ${KBDSUBDIRS} }"); do
[ ! -e "${initdir}/usr/share/${_src}" ] && ln -s "${kbddir}/${_src}" "${initdir}/usr/share/${_src}"
done
fi
--
2.19.1