grub2/0264-Add-comments-and-revert-logic-changes-in-01_fallback.patch
Javier Martinez Canillas 1f092caba7
Drop two efinet patches that were causing issues and a bunch of other fixes
Add comments and revert logic changes in 01_fallback_counting
Remove quotes when reading ID value from /etc/os-release
  Related: rhbz#1650706
blscfg: expand grub_users before passing to grub_normal_add_menu_entry()
  Resolves: rhbz#1650706
Drop buggy downstream patch "efinet: retransmit if our device is busy"
  Resolves: rhbz#1649048
Make the menu entry users option argument to be optional
  Related: rhbz#1652434
10_linux_bls: add missing menu entries options
  Resolves: rhbz#1652434
Drop "Be more aggro about actually using the *configured* network device."
  Resolves: rhbz#1654388
Fix menu entry selection based on title
  Resolves: rhbz#1654936

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-12-01 03:28:36 +01:00

48 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Christian Glombek <lorbus@fedoraproject.org>
Date: Mon, 8 Oct 2018 11:57:04 +0200
Subject: [PATCH] Add comments and revert logic changes in 01_fallback_counting
---
util/grub.d/01_fallback_counting.in | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/util/grub.d/01_fallback_counting.in b/util/grub.d/01_fallback_counting.in
index 1a0b5fbecfc..be0e770ea82 100644
--- a/util/grub.d/01_fallback_counting.in
+++ b/util/grub.d/01_fallback_counting.in
@@ -1,19 +1,22 @@
#! /bin/sh -e
-if ! systemctl -q is-enabled greenboot.service >/dev/null 2>&1 ; then
- exit 0
-fi
-
# Boot Counting
+# The boot_counter env var can be used to count down boot attempts after an
+# OSTree upgrade and choose the rollback deployment when 0 is reached. Both
+# boot_counter and boot_success need to be (re-)set from userspace.
cat << EOF
insmod increment
-if [ -z "\${boot_counter}" ]; then
- set boot_counter=0
-elif [ "\${boot_counter}" = "0" -o "\${boot_counter}" = "-1" ]; then
- increment default
- set boot_counter=-1
-else
- decrement boot_counter
+# 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 (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
-save_env boot_counter
EOF