grub2/0216-Boot-Counting.patch
Peter Jones f0ceaa7597 Fix typo in /etc/grub.d/01_fallback_counting
Resolves: rhbz#1614637
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-08-16 13:53:45 -04:00

48 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Christian Glombek <lorbus@fedoraproject.org>
Date: Tue, 31 Jul 2018 11:12:06 +0200
Subject: [PATCH] Boot Counting
Adds 01_fallback_counting.in script to support boot counting before
falling back to the previous menu entry automatically
---
Makefile.util.def | 6 ++++++
util/grub.d/01_fallback_counting.in | 12 ++++++++++++
2 files changed, 18 insertions(+)
create mode 100644 util/grub.d/01_fallback_counting.in
diff --git a/Makefile.util.def b/Makefile.util.def
index cba4d500198..c8cb91308d9 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -448,6 +448,12 @@ script = {
installdir = grubconf;
};
+script = {
+ name = '01_fallback_counting';
+ common = util/grub.d/01_fallback_counting.in;
+ installdir = grubconf;
+};
+
script = {
name = '01_menu_auto_hide';
common = util/grub.d/01_menu_auto_hide.in;
diff --git a/util/grub.d/01_fallback_counting.in b/util/grub.d/01_fallback_counting.in
new file mode 100644
index 00000000000..ecfc7401474
--- /dev/null
+++ b/util/grub.d/01_fallback_counting.in
@@ -0,0 +1,12 @@
+#! /bin/sh -e
+
+# Boot Counting
+if [ "\${boot_counter}" -a "\${boot_success}" = "0" ]; then
+ if [ "\${boot_counter}" = "0" -o "\${boot_counter}" = "-1" ]; then
+ set default=1
+ set boot_counter=-1
+ else
+ set boot_counter=$((\${boot_counter}-1))
+ fi
+ save_env boot_counter
+fi