dracut/0005-fix-incorrectly-applied-patch-in-commit-c6d18c3c7159.patch

76 lines
2.6 KiB
Diff
Raw Normal View History

From 35326479721f8b439f291bf8ff35354107144012 Mon Sep 17 00:00:00 2001
From: Pavel Valena <pvalena@redhat.com>
Date: Thu, 11 Jul 2024 07:33:05 +0200
Subject: [PATCH 05/32] fix: incorrectly applied patch in commit
c6d18c3c71597e78572378fc4dde391f1845b8
named: "feat(kernel-install): do nothing when $KERNEL_INSTALL_INITRD_GENERATOR says so"
Resolves: rhbz#2276271
---
install.d/50-dracut.install | 30 ++++++++++++++++++++++++++++--
install.d/51-dracut-rescue.install | 6 +++---
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/install.d/50-dracut.install b/install.d/50-dracut.install
index 3907e303..076b4f5e 100755
--- a/install.d/50-dracut.install
+++ b/install.d/50-dracut.install
@@ -18,8 +18,34 @@ if [ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" != "dracut" ]; then
exit 0
fi
-if [[ -d "$BOOT_DIR_ABS" ]]; then
- INITRD="initrd"
+# Do not attempt to create initramfs if the supplied image is already a UKI
+if [[ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]]; then
+ exit 0
+fi
+
+# Mismatching the install layout and the --uefi/--no-uefi opts just creates a mess.
+if [[ $KERNEL_INSTALL_LAYOUT == "uki" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then
+ BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA"
+ if [[ -z $KERNEL_INSTALL_UKI_GENERATOR || $KERNEL_INSTALL_UKI_GENERATOR == "dracut" ]]; then
+ # No uki generator preference set or we have been chosen
+ IMAGE="uki.efi"
+ UEFI_OPTS="--uefi"
+ elif [[ -z $KERNEL_INSTALL_INITRD_GENERATOR || $KERNEL_INSTALL_INITRD_GENERATOR == "dracut" ]]; then
+ # We aren't the uki generator, but we have been requested to make the initrd
+ IMAGE="initrd"
+ UEFI_OPTS="--no-uefi"
+ else
+ exit 0
+ fi
+elif [[ $KERNEL_INSTALL_LAYOUT == "bls" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then
+ BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA"
+ if [[ -z $KERNEL_INSTALL_INITRD_GENERATOR || $KERNEL_INSTALL_INITRD_GENERATOR == "dracut" ]]; then
+ IMAGE="initrd"
+ UEFI_OPTS="--no-uefi"
+ else
+ exit 0
+ fi
+
else
# No layout information, use users --uefi/--no-uefi preference
UEFI_OPTS=""
diff --git a/install.d/51-dracut-rescue.install b/install.d/51-dracut-rescue.install
index be4172b5..5310229e 100755
--- a/install.d/51-dracut-rescue.install
+++ b/install.d/51-dracut-rescue.install
@@ -13,9 +13,9 @@ if [ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" != "dracut" ]; then
exit 0
fi
-dropindirs_sort()
-{
- suffix=$1; shift
+dropindirs_sort() {
+ suffix=$1
+ shift
args=("$@")
files=$(
while (($# > 0)); do
--
2.42.0