Implement A/B switch when moving back to Barebox (#1794)
* Implement manual boot switch when downgrading to Barebox When installing OS 7 or older from a OS 8 installation, the bootloader is changed back to Barebox. However, in this case Barebox does not know which boot slot is correct (and rauc won't update Barebox' state as it is configured to work with GRUB in OS 8+). This implements a poor mans version to switch the boot partition. It clears Barebox state and deploys one of the two pre-configured default states, booting either boot slot A or B.
This commit is contained in:
@@ -28,6 +28,25 @@ case "$1" in
|
||||
slot-install)
|
||||
# Use install handlers below
|
||||
;;
|
||||
slot-post-install)
|
||||
# Handle main slot only
|
||||
test "${RAUC_SLOT_CLASS}" = "kernel" || exit 0
|
||||
|
||||
BOOT_MNT=/mnt/boot
|
||||
|
||||
if ! systemctl -q is-active mnt-boot.mount; then
|
||||
systemctl start mnt-boot.mount
|
||||
fi
|
||||
|
||||
# OS 8+ to 7 and lower downgrade path
|
||||
if ! command -v barebox-state > /dev/null; then
|
||||
cp -f "${BOOT_MNT}/EFI/barebox/state-${RAUC_SLOT_BOOTNAME}.dtb" "${BOOT_MNT}"/EFI/barebox/state.dtb
|
||||
blkdiscard /dev/disk/by-partuuid/33236519-7f32-4dff-8002-3390b62c309d
|
||||
echo "Cleared state and copied default state-${RAUC_SLOT_BOOTNAME}.dtb to state.dtb."
|
||||
fi
|
||||
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user