From 3d5f0bfe4e72fdc4d8f8d65f96dc5501dfed8a64 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 20 Jan 2023 09:05:18 +0100 Subject: kernel-install: handle uki installs automatically Detect image type using "bootctl kernel-identify $kernel", store result in KERNEL_INSTALL_IMAGE_TYPE. Extend layout autodetection to check the kernel image type and pick layout=uki for UKIs. Resolves: #25822 --- src/kernel-install/kernel-install.in | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/kernel-install') diff --git a/src/kernel-install/kernel-install.in b/src/kernel-install/kernel-install.in index fa2c0d5276..25884fc0e2 100755 --- a/src/kernel-install/kernel-install.in +++ b/src/kernel-install/kernel-install.in @@ -250,10 +250,18 @@ if [ -z "$ENTRY_TOKEN" ]; then echo "No entry-token candidate matched, using \"$ENTRY_TOKEN\" from machine-id" fi -if [ -z "$layout" ]; then +export KERNEL_INSTALL_IMAGE_TYPE="" +if [ -f "$1" ]; then + KERNEL_INSTALL_IMAGE_TYPE="$(bootctl kernel-identify "$1" 2>/dev/null || echo "unknown")" +fi + +if [ "$layout" = "auto" ] || [ -z "$layout" ]; then # No layout configured by the administrator. Let's try to figure it out # automatically from metadata already contained in $BOOT_ROOT. - if [ -e "$BOOT_ROOT/loader/entries.srel" ]; then + if [ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]; then + layout="uki" + log_verbose "Kernel image is UKI, using layout=$layout" + elif [ -e "$BOOT_ROOT/loader/entries.srel" ]; then read -r ENTRIES_SREL <"$BOOT_ROOT/loader/entries.srel" if [ "$ENTRIES_SREL" = "type1" ]; then # The loader/entries.srel file clearly indicates that the installed -- cgit v1.2.1