teknoraver / rpms / systemd

Forked from rpms/systemd a month ago
Clone

Blame SOURCES/0041-kernel-install-don-t-pull-out-KERNEL_IMAGE.patch

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