]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix: shellcheck for modules.d/10i18n/module-setup.sh
authorHarald Hoyer <harald@redhat.com>
Fri, 12 Feb 2021 12:26:10 +0000 (13:26 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Mon, 15 Feb 2021 10:00:37 +0000 (11:00 +0100)
modules.d/10i18n/module-setup.sh

index dd45b66617dea98fc0b6c7355f46713fcb90a7fa..04a402f117f31eff54076b15ab078ed37f527308 100755 (executable)
@@ -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