From 0267f886fcb2d9a4cf79adc1614957c53dbce16a Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 3 Oct 2023 15:11:11 -0400 Subject: [PATCH] grub2: Import greenboot configs Copied from https://github.com/osbuild/osbuild/blob/4e5de3808e2bf56e1060937c4d5e1796df441fa4/stages/org.osbuild.grub2#L280 Signed-off-by: Colin Walters --- src/grub2/grub-static-greenboot.cfg | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/grub2/grub-static-greenboot.cfg diff --git a/src/grub2/grub-static-greenboot.cfg b/src/grub2/grub-static-greenboot.cfg new file mode 100644 index 00000000..80be1079 --- /dev/null +++ b/src/grub2/grub-static-greenboot.cfg @@ -0,0 +1,19 @@ +# greenboot support, aka boot counter and boot success reporting +insmod increment +# Check if boot_counter exists and boot_success=0 to activate this behaviour. +if [ -n "${boot_counter}" -a "${boot_success}" = "0" ]; then + # if countdown has ended, choose to boot rollback deployment, + # i.e. default=1 on OSTree-based systems. + if [ "${boot_counter}" = "0" -o "${boot_counter}" = "-1" ]; then + set default=1 + set boot_counter=-1 + # otherwise decrement boot_counter + else + decrement boot_counter + fi + save_env boot_counter +fi + +# Reset boot_success for current boot +set boot_success=0 +save_env boot_success