#7 Add boot counting
Closed 3 years ago by pjones. Opened 3 years ago by lorbus.
rpms/ lorbus/grub2 master  into  master

Add boot counting
Christian Glombek • 3 years ago  
@@ -0,0 +1,36 @@ 

+ From 212c64e169bfa3d390342481d2defdcfe8c299d2 Mon Sep 17 00:00:00 2001

+ From: Christian Glombek <lorbus@fedoraproject.org>

+ Date: Tue, 31 Jul 2018 11:11:01 +0200

+ Subject: [PATCH 1/2] Rename 00_menu_auto_hide.in to 01_menu_auto_hide.in This

+  is necessary to accommodate the fallback counting script which needs to run

+  before this one because the menu auto hide script sets boot_success = 0,

+  which will be used by the boot counting script

+ 

+ ---

+  Makefile.util.def                                          | 4 ++--

+  util/grub.d/{00_menu_auto_hide.in => 01_menu_auto_hide.in} | 0

+  2 files changed, 2 insertions(+), 2 deletions(-)

+  rename util/grub.d/{00_menu_auto_hide.in => 01_menu_auto_hide.in} (100%)

+ 

+ diff --git a/Makefile.util.def b/Makefile.util.def

+ index c81801cda..aa650200b 100644

+ --- a/Makefile.util.def

+ +++ b/Makefile.util.def

+ @@ -443,8 +443,8 @@ script = {

+  };

+  

+  script = {

+ -  name = '00_menu_auto_hide';

+ -  common = util/grub.d/00_menu_auto_hide.in;

+ +  name = '01_menu_auto_hide';

+ +  common = util/grub.d/01_menu_auto_hide.in;

+    installdir = grubconf;

+  };

+  

+ diff --git a/util/grub.d/00_menu_auto_hide.in b/util/grub.d/01_menu_auto_hide.in

+ similarity index 100%

+ rename from util/grub.d/00_menu_auto_hide.in

+ rename to util/grub.d/01_menu_auto_hide.in

+ -- 

+ 2.14.3

+ 

@@ -0,0 +1,51 @@ 

+ From 34318948d2c539608071df231c9ff79d04b27a15 Mon Sep 17 00:00:00 2001

+ From: Christian Glombek <lorbus@fedoraproject.org>

+ Date: Tue, 31 Jul 2018 11:12:06 +0200

+ Subject: [PATCH 2/2] 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 aa650200b..29e0ea833 100644

+ --- a/Makefile.util.def

+ +++ b/Makefile.util.def

+ @@ -442,6 +442,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 000000000..37ee9e6ee

+ --- /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

+ -- 

+ 2.14.3

+ 

file modified
+2
@@ -370,3 +370,5 @@ 

  Patch0370: 0370-blscfg-Get-rid-of-the-linuxefi-linux16-linux-distinc.patch

  Patch0371: 0371-grub-switch-to-blscfg-Only-fix-boot-prefix-for-non-g.patch

  Patch0372: 0372-Have-another-stab-at-fixing-fdt-build-issues.patch

+ Patch0373: 0373-Rename-00_menu_auto_hide.in-to-01_menu_auto_hide.in.patch

+ Patch0374: 0374-Boot-Counting.patch

file modified
+4 -1
@@ -7,7 +7,7 @@ 

  Name:		grub2

  Epoch:		1

  Version:	2.02

- Release:	46%{?dist}

+ Release:	47%{?dist}

  Summary:	Bootloader with support for Linux, Multiboot and more

  Group:		System Environment/Base

  License:	GPLv3+
@@ -479,6 +479,9 @@ 

  %endif

  

  %changelog

+ * Tue Jul 31 2018 Christian Glombek <lorbus@fedoraproject.org> - 2.02-47

+ - Add boot counting

+ 

  * Tue Jul 17 2018 Peter Jones <pjones@redhat.com> - 2.02-46

  - Fix some minor BLS issues

  - Rework the FDT module linking to make aarch64 build and boot right