summaryrefslogtreecommitdiff
path: root/src/kernel-install
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2023-01-20 09:05:18 +0100
committerGerd Hoffmann <kraxel@redhat.com>2023-03-07 08:14:46 +0100
commit3d5f0bfe4e72fdc4d8f8d65f96dc5501dfed8a64 (patch)
treeda030d65956fb61c92d6a3e9636e7d72e45a1203 /src/kernel-install
parent642617f431457382ec2140a52ee08bfbb3e5e1db (diff)
downloadsystemd-3d5f0bfe4e72fdc4d8f8d65f96dc5501dfed8a64.tar.gz
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
Diffstat (limited to 'src/kernel-install')
-rwxr-xr-xsrc/kernel-install/kernel-install.in12
1 files changed, 10 insertions, 2 deletions
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