dcavalca / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
912206
From c8f460d77af6a530d226dae06cce0e462f13c82b Mon Sep 17 00:00:00 2001
912206
From: Daan De Meyer <daan.j.demeyer@gmail.com>
912206
Date: Mon, 29 Jul 2024 15:41:51 +0200
912206
Subject: [PATCH] kernel-install: Try some more initrd variants in
912206
 90-loaderentry.install
912206
912206
On CentOS/Fedora, dracut is configured to write the initrd to
912206
/boot/initramfs-$KERNEL_VERSION...img so let's check for that as well
912206
if no initrds were supplied.
912206
---
912206
 src/kernel-install/90-loaderentry.install.in | 17 +++++++++++++++--
912206
 1 file changed, 15 insertions(+), 2 deletions(-)
912206
912206
diff --git a/src/kernel-install/90-loaderentry.install.in b/src/kernel-install/90-loaderentry.install.in
912206
index 4ef6aca169c1a..57aac6aae4757 100755
912206
--- a/src/kernel-install/90-loaderentry.install.in
912206
+++ b/src/kernel-install/90-loaderentry.install.in
912206
@@ -205,8 +205,21 @@ mkdir -p "${LOADER_ENTRY%/*}" || {
912206
         have_initrd=yes
912206
     done
912206
 
912206
-    # Try "initrd", generated by dracut in its kernel-install hook, if no initrds were supplied
912206
-    [ -z "$have_initrd" ] && [ -f "$ENTRY_DIR_ABS/initrd" ] && echo "initrd     $ENTRY_DIR/initrd"
912206
+    # Try a few variations that are generated by various initrd generators in their kernel-install hooks if
912206
+    # no initrds were supplied.
912206
+
912206
+    if [ -z "$have_initrd" ] && [ -f "$ENTRY_DIR_ABS/initrd" ]; then
912206
+        echo "initrd     $ENTRY_DIR/initrd"
912206
+        have_initrd=yes
912206
+    fi
912206
+
912206
+    if [ -z "$have_initrd" ]; then
912206
+        for initrd in "$BOOT_ROOT"/initramfs-"$KERNEL_VERSION"*.img; do
912206
+            [ -f "$initrd" ] || continue
912206
+            echo "initrd     /${initrd##*/}"
912206
+            have_initrd=yes
912206
+        done
912206
+    fi
912206
     :
912206
 } >"$LOADER_ENTRY" || {
912206
     echo "Error: could not create loader entry '$LOADER_ENTRY'." >&2