]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
feat(install.d): allow using dracut in combination with ukify
authorAndrew Ammerlaan <andrewammerlaan@gentoo.org>
Sun, 20 Aug 2023 10:19:10 +0000 (12:19 +0200)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Tue, 22 Aug 2023 12:00:29 +0000 (08:00 -0400)
This can be simply accomplished with the KERNEL_INSTALL_INITRD_GENERATOR
and KERNEL_INSTALL_UKI_GENERATOR variables. `60-ukify.install` looks for
the initrd in the KERNEL_INSTALL_STAGING_AREA and then takes care of building
the uki.

This change makes it possible to use a configuration like this:
/etc/kernel/install.conf
layout=uki
uki_generator=ukify
initrd_generator=dracut

Without this change this configuration will fail since dracut would also
generate an uki instead of initrd, which will cause a problem in
`60-ukify.install` since it can't find an initrd to use.

Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
install.d/50-dracut.install

index 1caa2d7cac73795af087f26018d507dbb8e7bf0a..476506052a102ff5fdcfb8e0fe41b8d5a7f205c2 100755 (executable)
@@ -14,12 +14,25 @@ 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"
-    IMAGE="uki.efi"
-    UEFI_OPTS="--uefi"
+    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"
-    IMAGE="initrd"
-    UEFI_OPTS="--no-uefi"
+    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=""