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