richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
Blob Blame History Raw
From d778dd4a03f7bd45108fdebcc75dff5e886c30b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= <nabijaczleweli@nabijaczleweli.xyz>
Date: Thu, 16 Dec 2021 14:37:53 +0100
Subject: [PATCH] kernel-install: fix shellcheck

(cherry picked from commit 0bb1cb1fce5ebf307501dec1679e37f0c0157be9)

Related: #2065061
---
 src/kernel-install/kernel-install | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
index b358b03b2f..f6da0cf7a8 100755
--- a/src/kernel-install/kernel-install
+++ b/src/kernel-install/kernel-install
@@ -26,8 +26,8 @@ usage()
     echo "  $0 [OPTIONS...] add KERNEL-VERSION KERNEL-IMAGE [INITRD-FILE ...]"
     echo "  $0 [OPTIONS...] remove KERNEL-VERSION"
     echo "Options:"
-    echo "  -h,--help     Print this help"
-    echo "  -v,--verbose  Increase verbosity"
+    echo "  -h, --help     Print this help"
+    echo "  -v, --verbose  Increase verbosity"
 }
 
 dropindirs_sort()
@@ -58,15 +58,15 @@ dropindirs_sort()
 
 export LC_COLLATE=C
 
-for i in "$@"; do
-    if [ "$i" == "--help" -o "$i" == "-h" ]; then
+for i; do
+    if [ "$i" = "--help" ] || [ "$i" = "-h" ]; then
         usage
         exit 0
     fi
 done
 
 KERNEL_INSTALL_VERBOSE=0
-if [ "$1" == "--verbose" -o "$1" == "-v" ]; then
+if [ "$1" = "--verbose" ] || [ "$1" = "-v" ]; then
     shift
     KERNEL_INSTALL_VERBOSE=1
 fi
@@ -185,13 +185,13 @@ case $COMMAND in
         for f in "${PLUGINS[@]}"; do
             if [[ -x $f ]]; then
                 [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
-                    echo "+$f add $KERNEL_VERSION $ENTRY_DIR_ABS $KERNEL_IMAGE ${INITRD_OPTIONS[@]}"
+                    echo "+$f add $KERNEL_VERSION $ENTRY_DIR_ABS $KERNEL_IMAGE ${INITRD_OPTIONS[*]}"
                 "$f" add "$KERNEL_VERSION" "$ENTRY_DIR_ABS" "$KERNEL_IMAGE" "${INITRD_OPTIONS[@]}"
                 x=$?
-                if [[ $x == $SKIP_REMAINING ]]; then
+                if [ $x -eq "$SKIP_REMAINING" ]; then
                     break
                 fi
-                ((ret+=$x))
+                ((ret+=x))
             fi
         done
         ;;
@@ -203,10 +203,10 @@ case $COMMAND in
                     echo "+$f remove $KERNEL_VERSION $ENTRY_DIR_ABS"
                 "$f" remove "$KERNEL_VERSION" "$ENTRY_DIR_ABS"
                 x=$?
-                if [[ $x == $SKIP_REMAINING ]]; then
+                if [ $x -eq "$SKIP_REMAINING" ]; then
                     break
                 fi
-                ((ret+=$x))
+                ((ret+=x))
             fi
         done
 
@@ -222,4 +222,4 @@ case $COMMAND in
         ;;
 esac
 
-exit $ret
+exit "$ret"