teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0085-kernel-install-90-loaderentry-error-out-on-nonexiste.patch

8d419f
From bc1c914ebdec526151964c1aa3c2aeea0d4e2680 Mon Sep 17 00:00:00 2001
8d419f
From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= <nabijaczleweli@nabijaczleweli.xyz>
8d419f
Date: Fri, 17 Dec 2021 19:51:12 +0100
8d419f
Subject: [PATCH] kernel-install: 90-loaderentry: error out on nonexistent
8d419f
 initrds instead of swallowing them quietly
8d419f
8d419f
(cherry picked from commit 742561efbe938c45936f2e4f5d81b3ff6b352882)
8d419f
8d419f
Related: #2065061
8d419f
---
8d419f
 src/kernel-install/90-loaderentry.install | 12 +++++++-----
8d419f
 1 file changed, 7 insertions(+), 5 deletions(-)
8d419f
8d419f
diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install
8d419f
index 35324e69a9..e588e72bf9 100644
8d419f
--- a/src/kernel-install/90-loaderentry.install
8d419f
+++ b/src/kernel-install/90-loaderentry.install
8d419f
@@ -93,7 +93,10 @@ install -g root -o root -m 0644 "$KERNEL_IMAGE" "$ENTRY_DIR_ABS/linux" || {
8d419f
 
8d419f
 shift "$INITRD_OPTIONS_SHIFT"
8d419f
 for initrd; do
8d419f
-    [ -f "$initrd" ] || continue
8d419f
+    [ -f "$initrd" ] || {
8d419f
+        echo "Initrd '$initrd' not a file." >&2
8d419f
+        exit 1
8d419f
+    }
8d419f
 
8d419f
     initrd_basename="${initrd##*/}"
8d419f
     [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "Installing $ENTRY_DIR_ABS/$initrd_basename"
8d419f
@@ -108,9 +111,6 @@ mkdir -p "${LOADER_ENTRY%/*}" || {
8d419f
     exit 1
8d419f
 }
8d419f
 
8d419f
-# Try "initrd", generated by dracut in its kernel-install hook, if no initrds were supplied
8d419f
-[ $# -eq 0 ] && set -- "initrd"
8d419f
-
8d419f
 [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "Creating $LOADER_ENTRY"
8d419f
 {
8d419f
     echo "title      $PRETTY_NAME"
8d419f
@@ -119,8 +119,10 @@ mkdir -p "${LOADER_ENTRY%/*}" || {
8d419f
     echo "options    $BOOT_OPTIONS"
8d419f
     echo "linux      $ENTRY_DIR/linux"
8d419f
     for initrd; do
8d419f
-        [ -f "$ENTRY_DIR_ABS/${initrd##*/}" ] && echo "initrd     $ENTRY_DIR/${initrd##*/}"
8d419f
+        echo "initrd     $ENTRY_DIR/${initrd##*/}"
8d419f
     done
8d419f
+    # Try "initrd", generated by dracut in its kernel-install hook, if no initrds were supplied
8d419f
+    [ $# -eq 0 ] && [ -f "$ENTRY_DIR_ABS/initrd" ] && echo "initrd     $ENTRY_DIR/initrd"
8d419f
     :
8d419f
 } >"$LOADER_ENTRY" || {
8d419f
     echo "Could not create loader entry '$LOADER_ENTRY'." >&2