aa0848
From d778dd4a03f7bd45108fdebcc75dff5e886c30b2 Mon Sep 17 00:00:00 2001
aa0848
From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= <nabijaczleweli@nabijaczleweli.xyz>
aa0848
Date: Thu, 16 Dec 2021 14:37:53 +0100
aa0848
Subject: [PATCH] kernel-install: fix shellcheck
aa0848
aa0848
(cherry picked from commit 0bb1cb1fce5ebf307501dec1679e37f0c0157be9)
aa0848
aa0848
Related: #2065061
aa0848
---
aa0848
 src/kernel-install/kernel-install | 22 +++++++++++-----------
aa0848
 1 file changed, 11 insertions(+), 11 deletions(-)
aa0848
aa0848
diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
aa0848
index b358b03b2f..f6da0cf7a8 100755
aa0848
--- a/src/kernel-install/kernel-install
aa0848
+++ b/src/kernel-install/kernel-install
aa0848
@@ -26,8 +26,8 @@ usage()
aa0848
     echo "  $0 [OPTIONS...] add KERNEL-VERSION KERNEL-IMAGE [INITRD-FILE ...]"
aa0848
     echo "  $0 [OPTIONS...] remove KERNEL-VERSION"
aa0848
     echo "Options:"
aa0848
-    echo "  -h,--help     Print this help"
aa0848
-    echo "  -v,--verbose  Increase verbosity"
aa0848
+    echo "  -h, --help     Print this help"
aa0848
+    echo "  -v, --verbose  Increase verbosity"
aa0848
 }
aa0848
 
aa0848
 dropindirs_sort()
aa0848
@@ -58,15 +58,15 @@ dropindirs_sort()
aa0848
 
aa0848
 export LC_COLLATE=C
aa0848
 
aa0848
-for i in "$@"; do
aa0848
-    if [ "$i" == "--help" -o "$i" == "-h" ]; then
aa0848
+for i; do
aa0848
+    if [ "$i" = "--help" ] || [ "$i" = "-h" ]; then
aa0848
         usage
aa0848
         exit 0
aa0848
     fi
aa0848
 done
aa0848
 
aa0848
 KERNEL_INSTALL_VERBOSE=0
aa0848
-if [ "$1" == "--verbose" -o "$1" == "-v" ]; then
aa0848
+if [ "$1" = "--verbose" ] || [ "$1" = "-v" ]; then
aa0848
     shift
aa0848
     KERNEL_INSTALL_VERBOSE=1
aa0848
 fi
aa0848
@@ -185,13 +185,13 @@ case $COMMAND in
aa0848
         for f in "${PLUGINS[@]}"; do
aa0848
             if [[ -x $f ]]; then
aa0848
                 [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
aa0848
-                    echo "+$f add $KERNEL_VERSION $ENTRY_DIR_ABS $KERNEL_IMAGE ${INITRD_OPTIONS[@]}"
aa0848
+                    echo "+$f add $KERNEL_VERSION $ENTRY_DIR_ABS $KERNEL_IMAGE ${INITRD_OPTIONS[*]}"
aa0848
                 "$f" add "$KERNEL_VERSION" "$ENTRY_DIR_ABS" "$KERNEL_IMAGE" "${INITRD_OPTIONS[@]}"
aa0848
                 x=$?
aa0848
-                if [[ $x == $SKIP_REMAINING ]]; then
aa0848
+                if [ $x -eq "$SKIP_REMAINING" ]; then
aa0848
                     break
aa0848
                 fi
aa0848
-                ((ret+=$x))
aa0848
+                ((ret+=x))
aa0848
             fi
aa0848
         done
aa0848
         ;;
aa0848
@@ -203,10 +203,10 @@ case $COMMAND in
aa0848
                     echo "+$f remove $KERNEL_VERSION $ENTRY_DIR_ABS"
aa0848
                 "$f" remove "$KERNEL_VERSION" "$ENTRY_DIR_ABS"
aa0848
                 x=$?
aa0848
-                if [[ $x == $SKIP_REMAINING ]]; then
aa0848
+                if [ $x -eq "$SKIP_REMAINING" ]; then
aa0848
                     break
aa0848
                 fi
aa0848
-                ((ret+=$x))
aa0848
+                ((ret+=x))
aa0848
             fi
aa0848
         done
aa0848
 
aa0848
@@ -222,4 +222,4 @@ case $COMMAND in
aa0848
         ;;
aa0848
 esac
aa0848
 
aa0848
-exit $ret
aa0848
+exit "$ret"