summaryrefslogtreecommitdiff
path: root/src/kernel-install
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2023-03-03 00:45:45 +0000
committerLuca Boccassi <bluca@debian.org>2023-03-03 10:50:57 +0000
commit41f39e2144c935868059e894c1a1e13803e3568f (patch)
tree6e3896ca4da5de3d2d0c4cd7c5c27960d35ecc83 /src/kernel-install
parent3bf7e3c06e89f907dae75fbbae4405a948f611ef (diff)
downloadsystemd-41f39e2144c935868059e894c1a1e13803e3568f.tar.gz
kernel-install: also try to find $BOOT by partition GUID
When there is nothing set up on /boot, /boot/efi or /efi, try to find the $BOOT partition checking for the XBOOTLDR or ESP partition GUIDs. Prefer XBOOTLDR as per BLS. Fixes https://github.com/systemd/systemd/issues/26644
Diffstat (limited to 'src/kernel-install')
-rwxr-xr-xsrc/kernel-install/kernel-install.in20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/kernel-install/kernel-install.in b/src/kernel-install/kernel-install.in
index 9cfcd4dbb9..c722dc0f77 100755
--- a/src/kernel-install/kernel-install.in
+++ b/src/kernel-install/kernel-install.in
@@ -206,6 +206,7 @@ else
BOOT_ROOT_SEARCH="/efi /boot /boot/efi"
fi
+# First search for existing setups in any of the known directories.
for pref in $BOOT_ROOT_SEARCH; do
for suff in $ENTRY_TOKEN_SEARCH; do
if [ -d "$pref/$suff" ]; then
@@ -228,6 +229,24 @@ for pref in $BOOT_ROOT_SEARCH; do
done
done
+# If we haven't found anything, and if we have lsblk, use the partition GUID to
+# search for XBOOTLDR (first) or ESP (as a fallback).
+if [ -z "$BOOT_ROOT" ] && command -v lsblk >/dev/null 2>&1; then
+ for guid in bc13c2ff-59e6-4262-a352-b275fd6f7172 c12a7328-f81f-11d2-ba4b-00a0c93ec93b; do
+ eval "$(lsblk --pairs --output MOUNTPOINT,PARTTYPE | grep "$guid")"
+ BOOT_ROOT="$MOUNTPOINT"
+ unset MOUNTPOINT
+ unset PARTTYPE
+
+ if [ -n "$BOOT_ROOT" ]; then
+ log_verbose "$BOOT_ROOT is a mount point for partition GUID $guid, using BOOT_ROOT=$BOOT_ROOT"
+ break
+ fi
+ done
+fi
+
+# Finally if we still haven't found anything, check if /efi or /boot/efi are mountpoints
+# and if so, assume they point to the ESP.
[ -z "$BOOT_ROOT" ] && for pref in "/efi" "/boot/efi"; do
if mountpoint -q "$pref"; then
BOOT_ROOT="$pref"
@@ -238,6 +257,7 @@ done
fi
done
+# If all else fails, install on /boot.
if [ -z "$BOOT_ROOT" ]; then
BOOT_ROOT="/boot"
log_verbose "KERNEL_INSTALL_BOOT_ROOT autodetection yielded no candidates, using \"$BOOT_ROOT\""