Fix migration from Barebox GRUB (#1767)

* Fix migration from Barebox GRUB

Create GRUB env which defaults to the boot slot we are updating to. This
makes sure that the newly installed OS version will be booted on next
reboot even if installed on boot slot B.
This commit is contained in:
Stefan Agner
2022-02-25 19:17:49 +01:00
committed by GitHub
parent 5a409ec0ec
commit 381026758a
2 changed files with 14 additions and 1 deletions

View File

@@ -54,6 +54,12 @@ if [ "${RAUC_SLOT_CLASS}" = "boot" ]; then
# Update
cp -rf "${BOOT_NEW}"/* "${BOOT_MNT}/"
# If grubenv is missing, initialize with boot order which will try the right
# boot slot
if [ -d "${BOOT_NEW}"/EFI/BOOT/ ] && [ ! -f "${BOOT_NEW}"/EFI/BOOT/grubenv ]; then
cp -f "${BOOT_NEW}/EFI/BOOT/grubenv-${RAUC_SLOT_BOOTNAME}" "${BOOT_NEW}"/EFI/BOOT/grubenv
fi
# Restore boot config
cp -f "${BOOT_TMP}"/*.txt "${BOOT_MNT}/"