The Thistle Update Client fully supports A/B full filesystem updates using Grub as a bootloader. The interaction is simple, and relies on Grub environment variables. In order to function, we require your system to come with the grub-editenv binary available on the path. After performing a filesystem update, our Update Client will then direct the bootloader to perform a tentative boot on the partion a or b. After the system boots up, our update client will verify that the system started accordingly, and set the new partition as the default boot partition.

Update Client Integration

It is required to configure the location of the Grub Environment on the Update Client Configuration.
{
  ...
  "bootloader": "grub",
  "grub_env": "/boot/grub/grubenv"
}

Integration

In order for our update client to integrate with your Grub settings, the following script is required in your grub.cfg. This snippet will be used to determine the partition to boot from.
load_env bootpart
load_env tryboot

# If tryboot is set, use it and clear it
if [ -n "${tryboot}" ]; then
  echo "Tryboot override: ${tryboot}"
  set boot_target="${tryboot}"
  set tryboot=
  save_env tryboot
else
  set boot_target="${bootpart}"
fi
Then the boot sequence should be implemented in this fashion:
if [ "${boot_target}" = "a" ]; then
  echo "Booting part A"
  search --no-floppy --fs-uuid --set=root 9ba33f35-78e7-4bf1-ae17-14a327f50683
  linux /boot/vmlinuz-linux console=ttyS0 root=UUID=9ba33f35-78e7-4bf1-ae17-14a327f50683 rw
  initrd /boot/initramfs-linux.img
  boot
elif [ "${boot_target}" = "b" ]; then
  echo "Booting part B"
  search --no-floppy --fs-uuid --set=root fc44068a-22d6-4c92-b386-ec2020935e27
  linux /boot/vmlinuz-linux console=ttyS0 root=UUID=fc44068a-22d6-4c92-b386-ec2020935e27 rw
  initrd /boot/initramfs-linux.img
  boot
else
  echo "Unknown boot target: ${boot_target}"
  sleep 5
fi