richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
8d419f
From 8a52c3a1797084956ddcd2acfb65a4023a4f0655 Mon Sep 17 00:00:00 2001
8d419f
From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= <nabijaczleweli@nabijaczleweli.xyz>
8d419f
Date: Mon, 20 Dec 2021 14:57:39 +0100
8d419f
Subject: [PATCH] kernel-install: don't pull out KERNEL_IMAGE
8d419f
8d419f
It's part of the pack directly passed to scripts on add and ignored on
8d419f
remove
8d419f
8d419f
(cherry picked from commit af319a4b14bd05cd4c8460487f2c6d7a31b35640)
8d419f
8d419f
Related: #2065061
8d419f
---
8d419f
 src/kernel-install/kernel-install | 21 ++++++++++-----------
8d419f
 1 file changed, 10 insertions(+), 11 deletions(-)
8d419f
8d419f
diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
8d419f
index 2e8f382d5f..097d6557f2 100755
8d419f
--- a/src/kernel-install/kernel-install
8d419f
+++ b/src/kernel-install/kernel-install
8d419f
@@ -72,15 +72,14 @@ else
8d419f
     [ $# -ge 1 ] && shift
8d419f
 fi
8d419f
 
8d419f
-KERNEL_VERSION="$1"
8d419f
-KERNEL_IMAGE="$2"
8d419f
-[ $# -ge 2 ] && shift 2
8d419f
-
8d419f
-if [ -z "$COMMAND" ] || [ -z "$KERNEL_VERSION" ]; then
8d419f
+if [ $# -lt 1 ]; then
8d419f
     echo "Not enough arguments" >&2
8d419f
     exit 1
8d419f
 fi
8d419f
 
8d419f
+KERNEL_VERSION="$1"
8d419f
+shift
8d419f
+
8d419f
 if [ -r "/etc/kernel/install.conf" ]; then
8d419f
     . /etc/kernel/install.conf
8d419f
 elif [ -r "/usr/lib/kernel/install.conf" ]; then
8d419f
@@ -147,13 +146,13 @@ IFS="
8d419f
 
8d419f
 case "$COMMAND" in
8d419f
     add)
8d419f
-        if [ -z "$KERNEL_IMAGE" ]; then
8d419f
-            echo "Command 'add' requires an argument" >&2
8d419f
+        if [ $# -lt 1 ]; then
8d419f
+            echo "Command 'add' requires a kernel image" >&2
8d419f
             exit 1
8d419f
         fi
8d419f
 
8d419f
-        if ! [ -f "$KERNEL_IMAGE" ]; then
8d419f
-            echo "Kernel image argument $KERNEL_IMAGE not a file" >&2
8d419f
+        if ! [ -f "$1" ]; then
8d419f
+            echo "Kernel image argument $1 not a file" >&2
8d419f
             exit 1
8d419f
         fi
8d419f
 
8d419f
@@ -170,8 +169,8 @@ case "$COMMAND" in
8d419f
         fi
8d419f
 
8d419f
         for f in $PLUGINS; do
8d419f
-            [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "+$f add $KERNEL_VERSION $ENTRY_DIR_ABS $KERNEL_IMAGE $*"
8d419f
-            "$f" add "$KERNEL_VERSION" "$ENTRY_DIR_ABS" "$KERNEL_IMAGE" "$@"
8d419f
+            [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "+$f add $KERNEL_VERSION $ENTRY_DIR_ABS $*"
8d419f
+            "$f" add "$KERNEL_VERSION" "$ENTRY_DIR_ABS" "$@"
8d419f
             err=$?
8d419f
             [ $err -eq $skip_remaining ] && break
8d419f
             ret=$(( ret + err ))