summaryrefslogtreecommitdiff
path: root/src/kernel-install/kernel-install.in
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-05-19 15:34:32 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-05-20 09:44:22 +0200
commiteb45cf97a9740055515ccbcab8231b33ea0df237 (patch)
treef2cd515513869f33d2f8868ce7f0c0e4320dcfbf /src/kernel-install/kernel-install.in
parent4db4c28dc6928e0040db7c273f3017ebc1368760 (diff)
downloadsystemd-eb45cf97a9740055515ccbcab8231b33ea0df237.tar.gz
kernel-install: fix detection of entry-token if $BOOT_ROOT is configured
If $BOOT_ROOT is specified, but entry-token not, we'd skip the detection altogether, effectively defaulting to entry-token=machine-id. The case where $BOOT_ROOT was not specied, but entry-token was configured was handled correctly. This patch makes the handling of both symmetrical, i.e. will only set what wasn't configured.
Diffstat (limited to 'src/kernel-install/kernel-install.in')
-rwxr-xr-xsrc/kernel-install/kernel-install.in15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/kernel-install/kernel-install.in b/src/kernel-install/kernel-install.in
index 8ed9bfbb33..9fa12f6fe8 100755
--- a/src/kernel-install/kernel-install.in
+++ b/src/kernel-install/kernel-install.in
@@ -170,11 +170,18 @@ fi
# $ENTRY_TOKEN can be any string that fits into a VFAT filename, though
# typically is just the machine ID.
-[ -z "$BOOT_ROOT" ] && for suff in $ENTRY_TOKEN_SEARCH; do
- for pref in "/efi" "/boot" "/boot/efi"; do
+if [ -n "$BOOT_ROOT" ]; then
+ # If this was already configured, don't try to guess
+ BOOT_ROOT_SEARCH="$BOOT_ROOT"
+else
+ BOOT_ROOT_SEARCH="/efi /boot /boot/efi"
+fi
+
+for suff in $ENTRY_TOKEN_SEARCH; do
+ for pref in $BOOT_ROOT_SEARCH; do
if [ -d "$pref/$suff" ]; then
- BOOT_ROOT="$pref"
- ENTRY_TOKEN="$suff"
+ [ -z "$BOOT_ROOT" ] && BOOT_ROOT="$pref"
+ [ -z "$ENTRY_TOKEN" ] && ENTRY_TOKEN="$suff"
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
echo "$pref/$suff exists, using BOOT_ROOT=$BOOT_ROOT, ENTRY_TOKEN=$ENTRY_TOKEN"