Before
9e82a74cb0f08a288f9db228a0b5bec8a7188cdb, we had a check like the
following:
if [[ -d /efi/loader/entries ]] || [[ -d /efi/$MACHINE_ID ]]; then
ENTRY_DIR_ABS="/efi/$MACHINE_ID/$KERNEL_VERSION"
elif [[ -d /boot/loader/entries ]] || [[ -d /boot/$MACHINE_ID ]]; then
ENTRY_DIR_ABS="/boot/$MACHINE_ID/$KERNEL_VERSION"
elif [[ -d /boot/efi/loader/entries ]] || [[ -d /boot/efi/$MACHINE_ID ]]; then
ENTRY_DIR_ABS="/boot/efi/$MACHINE_ID/$KERNEL_VERSION"
…
In stock Fedora 34-, /efi isn't used, but grub creates /boot/loader/entries and
installs kernels and initrds directly in /boot. Thus the second arm of the
check wins, and we end up with BOOT_ROOT=/boot.
After
9e82a74cb0f08a288f9db228a0b5bec8a7188cdb, we iterate over the inner
directory first and over the second directory later:
[ -d /efi/<machine-id> ]
[ -d /boot/efi/<machine-id> ]
[ -d /boot/<machine-id> ]
[ -d /efi/Default ]
[ -d /boot/efi/Default ]
[ -d /boot/Default ]
[ -d /efi/loader/entries ]
[ -d /boot/efi/loader/entries ]
[ -d /boot/loader/entries ]
This was partially reverted by
447a822f8ee47b63a4cae00423c4d407bfa5e516 which
removed Default from the list, and
a5307e173bf86d695fe85b8e15e91126e8618a14,
which moved checks for /boot up, so we ended up with:
[ -d /efi/<machine-id> ]
[ -d /boot/<machine-id> ]
[ -d /boot/efi/<machine-id> ]
[ -d /efi/loader/entries ]
[ -d /boot/loader/entries ]
[ -d /boot/efi/loader/entries ]
6637cf9db67237857279262d93ee0e39023c5b85 added autodetection of an entry
token, so we end up checking the following suffixes:
<machine-id>, $IMAGE_ID, $ID, Default
But the important unchanged characteristic is that we iterate over the suffix
first. Sadly this breaks Fedora, because we find /boot/efi/<machine-id> before
we could find /boot/loader/entries. It seems that every possible aspect of
behaviour matters for somebody, so we need to keep the original order of
detection.
With the patch:
[ -d /efi/<machine-id> ]
...
[ -d /efi/loader/entries ]
[ -d /boot/<machine-id> ]
...
[ -d /boot/loader/entries ]
[ -d /boot/efi/<machine-id> ]
...
[ -d /boot/efi/loader/entries ]
Note that we need to check for "loader/entries" too, even though it is not
an entry-token candidate, so that we get the same detection priority as
before.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=
2071034.
BOOT_ROOT_SEARCH="/efi /boot /boot/efi"
fi
-for suff in $ENTRY_TOKEN_SEARCH; do
- for pref in $BOOT_ROOT_SEARCH; do
+for pref in $BOOT_ROOT_SEARCH; do
+ for suff in $ENTRY_TOKEN_SEARCH; do
if [ -d "$pref/$suff" ]; then
[ -z "$BOOT_ROOT" ] && BOOT_ROOT="$pref"
[ -z "$ENTRY_TOKEN" ] && ENTRY_TOKEN="$suff"
else
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "$pref/$suff not found…"
fi
- done
-done
-
-[ -z "$BOOT_ROOT" ] && for pref in "/efi" "/boot" "/boot/efi"; do
- if [ -d "$pref/loader/entries" ]; then
- BOOT_ROOT="$pref"
- [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
- echo "$pref/loader/entries exists, using BOOT_ROOT=$BOOT_ROOT"
- break
- else
- [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "$pref/loader/entries not found…"
- fi
+ if [ -d "$pref/loader/entries" ]; then
+ [ -z "$BOOT_ROOT" ] && BOOT_ROOT="$pref"
+ [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
+ echo "$pref/loader/entries exists, using BOOT_ROOT=$BOOT_ROOT"
+ break 2
+ else
+ [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "$pref/loader/entries not found…"
+ fi
+ done
done
[ -z "$BOOT_ROOT" ] && for pref in "/efi" "/boot/efi"; do