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