From 9122060ba8c174e37d066dc1471dca72cc7accbd Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Jul 29 2024 13:49:54 +0000 Subject: Backport upstream patch to try more initrd variants in 90-loaderentry.install This makes sure that 90-loaderentry.install plays nicely with the dracut kernel-install plugin that is shipped in Fedora and CentOS Stream. --- diff --git a/33861.patch b/33861.patch new file mode 100644 index 0000000..632f821 --- /dev/null +++ b/33861.patch @@ -0,0 +1,41 @@ +From c8f460d77af6a530d226dae06cce0e462f13c82b Mon Sep 17 00:00:00 2001 +From: Daan De Meyer +Date: Mon, 29 Jul 2024 15:41:51 +0200 +Subject: [PATCH] kernel-install: Try some more initrd variants in + 90-loaderentry.install + +On CentOS/Fedora, dracut is configured to write the initrd to +/boot/initramfs-$KERNEL_VERSION...img so let's check for that as well +if no initrds were supplied. +--- + src/kernel-install/90-loaderentry.install.in | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/src/kernel-install/90-loaderentry.install.in b/src/kernel-install/90-loaderentry.install.in +index 4ef6aca169c1a..57aac6aae4757 100755 +--- a/src/kernel-install/90-loaderentry.install.in ++++ b/src/kernel-install/90-loaderentry.install.in +@@ -205,8 +205,21 @@ mkdir -p "${LOADER_ENTRY%/*}" || { + have_initrd=yes + done + +- # Try "initrd", generated by dracut in its kernel-install hook, if no initrds were supplied +- [ -z "$have_initrd" ] && [ -f "$ENTRY_DIR_ABS/initrd" ] && echo "initrd $ENTRY_DIR/initrd" ++ # Try a few variations that are generated by various initrd generators in their kernel-install hooks if ++ # no initrds were supplied. ++ ++ if [ -z "$have_initrd" ] && [ -f "$ENTRY_DIR_ABS/initrd" ]; then ++ echo "initrd $ENTRY_DIR/initrd" ++ have_initrd=yes ++ fi ++ ++ if [ -z "$have_initrd" ]; then ++ for initrd in "$BOOT_ROOT"/initramfs-"$KERNEL_VERSION"*.img; do ++ [ -f "$initrd" ] || continue ++ echo "initrd /${initrd##*/}" ++ have_initrd=yes ++ done ++ fi + : + } >"$LOADER_ENTRY" || { + echo "Error: could not create loader entry '$LOADER_ENTRY'." >&2 diff --git a/systemd.spec b/systemd.spec index 210c1f7..fc511ba 100644 --- a/systemd.spec +++ b/systemd.spec @@ -119,6 +119,8 @@ Patch0010: https://github.com/systemd/systemd/pull/26494.patch # Requested in https://bugzilla.redhat.com/show_bug.cgi?id=2298422 Patch0011: https://github.com/systemd/systemd/pull/33738.patch +Patch0012: https://github.com/systemd/systemd/pull/33861.patch + # Those are downstream-only patches, but we don't want them in packit builds: # https://bugzilla.redhat.com/show_bug.cgi?id=2251843 Patch0491: https://github.com/systemd/systemd/pull/30846.patch