From db4a99687c8306760702abda9c01a2e74d19a3f3 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 4 Oct 2018 17:11:21 -0400 Subject: [PATCH] Exclude /etc/grub.d/01_fallback_counting until we work through some design questions. Resolves: rhbz#1614637 Signed-off-by: Peter Jones --- 0216-Boot-Counting.patch | 48 ----- ...e-the-firmware-acceleration-for-http.patch | 0 ...ot_url-reflect-the-protocol-hostname.patch | 0 ...t-multiboot2-and-linux16-modules-on-.patch | 0 ...0219-Force-everything-to-use-python3.patch | 0 ...patch => 0220-Fix-an-8-year-old-typo.patch | 0 ...n-don-t-run-autoreconf-in-the-topdir.patch | 0 ...n-tell-configure-which-cflags-utils-.patch | 0 ...make-it-possible-to-run-checkers-on-.patch | 0 ...fier-report-the-filename-or-modname-.patch | 0 ...fs-not-duplicate-symbols-from-efinet.patch | 0 ...26-Rework-how-the-fdt-command-builds.patch | 0 ...able-non-wordsize-allocations-on-arm.patch | 0 ...-R-.note.gnu.property-at-more-places.patch | 0 ...nd-prefix-when-HTTP-path-is-relative.patch | 0 ...ernel_header.hdr_offset-be-at-the-ri.patch | 0 ...> 0231-Mark-some-unused-stuff-unused.patch | 0 ...=> 0232-Make-grub_error-more-verbose.patch | 0 ...eset-an-alias-for-the-reboot-command.patch | 0 ...-debug-output-on-GOP-and-UGA-probing.patch | 0 ....patch => 0235-Add-a-version-command.patch | 0 ...dprintf-and-nerf-dprintf-in-script.c.patch | 0 ...-Better-memory-allocation-and-error-.patch | 0 ...tter-locations-for-kernel-and-initrd.patch | 0 ...p-all-the-places-Wsign-compare-error.patch | 0 ...gn-compare-Wno-conversion-Wno-error-.patch | 0 ...s.timer-Add-a-few-Conditions-for-run.patch | 0 ...ce-buffers-for-reading-to-addresses-.patch | 0 ...-arrange-grub_cmd_linux-a-little-bit.patch | 0 ...e-our-own-allocator-for-kernel-stuff.patch | 0 ...itrd-params-cmdline-allocations-abov.patch | 0 ...polkit-pkexec-for-grub-boot-success..patch | 0 ...247-drop-TPM-support-for-legacy-BIOS.patch | 0 ...unction-from-kernel.exec-to-the-blsc.patch | 0 ...e-blscfg-module-for-powerpc-ieee1275.patch | 0 ...lscfg-copy-blscfg-module-for-legacy-.patch | 0 ... => 0251-Fix-getroot.c-s-trampolines.patch | 0 ...not-allow-stack-trampolines-anywhere.patch | 0 0253-Reimplement-boot_counter.patch | 187 ++++++++++++++++++ ...t-counting-grub.cfg-snippet-creation.patch | 27 --- ...fallback-counting-script-even-harder.patch | 29 --- grub.macros | 2 +- grub.patches | 78 ++++---- grub2.spec | 8 +- 44 files changed, 233 insertions(+), 146 deletions(-) delete mode 100644 0216-Boot-Counting.patch rename 0217-efinet-also-use-the-firmware-acceleration-for-http.patch => 0216-efinet-also-use-the-firmware-acceleration-for-http.patch (100%) rename 0218-efi-http-Make-root_url-reflect-the-protocol-hostname.patch => 0217-efi-http-Make-root_url-reflect-the-protocol-hostname.patch (100%) rename 0219-Disable-multiboot-multiboot2-and-linux16-modules-on-.patch => 0218-Disable-multiboot-multiboot2-and-linux16-modules-on-.patch (100%) rename 0220-Force-everything-to-use-python3.patch => 0219-Force-everything-to-use-python3.patch (100%) rename 0221-Fix-an-8-year-old-typo.patch => 0220-Fix-an-8-year-old-typo.patch (100%) rename 0222-autogen-don-t-run-autoreconf-in-the-topdir.patch => 0221-autogen-don-t-run-autoreconf-in-the-topdir.patch (100%) rename 0223-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch => 0222-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch (100%) rename 0224-module-verifier-make-it-possible-to-run-checkers-on-.patch => 0223-module-verifier-make-it-possible-to-run-checkers-on-.patch (100%) rename 0225-grub-module-verifier-report-the-filename-or-modname-.patch => 0224-grub-module-verifier-report-the-filename-or-modname-.patch (100%) rename 0226-Make-efi_netfs-not-duplicate-symbols-from-efinet.patch => 0225-Make-efi_netfs-not-duplicate-symbols-from-efinet.patch (100%) rename 0227-Rework-how-the-fdt-command-builds.patch => 0226-Rework-how-the-fdt-command-builds.patch (100%) rename 0228-Disable-non-wordsize-allocations-on-arm.patch => 0227-Disable-non-wordsize-allocations-on-arm.patch (100%) rename 0229-strip-R-.note.gnu.property-at-more-places.patch => 0228-strip-R-.note.gnu.property-at-more-places.patch (100%) rename 0230-Prepend-prefix-when-HTTP-path-is-relative.patch => 0229-Prepend-prefix-when-HTTP-path-is-relative.patch (100%) rename 0231-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch => 0230-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch (100%) rename 0232-Mark-some-unused-stuff-unused.patch => 0231-Mark-some-unused-stuff-unused.patch (100%) rename 0233-Make-grub_error-more-verbose.patch => 0232-Make-grub_error-more-verbose.patch (100%) rename 0234-Make-reset-an-alias-for-the-reboot-command.patch => 0233-Make-reset-an-alias-for-the-reboot-command.patch (100%) rename 0235-EFI-more-debug-output-on-GOP-and-UGA-probing.patch => 0234-EFI-more-debug-output-on-GOP-and-UGA-probing.patch (100%) rename 0236-Add-a-version-command.patch => 0235-Add-a-version-command.patch (100%) rename 0237-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch => 0236-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch (100%) rename 0238-arm-arm64-loader-Better-memory-allocation-and-error-.patch => 0237-arm-arm64-loader-Better-memory-allocation-and-error-.patch (100%) rename 0239-Try-to-pick-better-locations-for-kernel-and-initrd.patch => 0238-Try-to-pick-better-locations-for-kernel-and-initrd.patch (100%) rename 0240-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch => 0239-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch (100%) rename 0241-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch => 0240-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch (100%) rename 0242-grub-boot-success.timer-Add-a-few-Conditions-for-run.patch => 0241-grub-boot-success.timer-Add-a-few-Conditions-for-run.patch (100%) rename 0243-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch => 0242-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch (100%) rename 0244-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch => 0243-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch (100%) rename 0245-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch => 0244-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch (100%) rename 0246-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch => 0245-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch (100%) rename 0247-docs-Stop-using-polkit-pkexec-for-grub-boot-success..patch => 0246-docs-Stop-using-polkit-pkexec-for-grub-boot-success..patch (100%) rename 0248-drop-TPM-support-for-legacy-BIOS.patch => 0247-drop-TPM-support-for-legacy-BIOS.patch (100%) rename 0249-Move-quicksort-function-from-kernel.exec-to-the-blsc.patch => 0248-Move-quicksort-function-from-kernel.exec-to-the-blsc.patch (100%) rename 0250-Include-blscfg-module-for-powerpc-ieee1275.patch => 0249-Include-blscfg-module-for-powerpc-ieee1275.patch (100%) rename 0251-grub-switch-to-blscfg-copy-blscfg-module-for-legacy-.patch => 0250-grub-switch-to-blscfg-copy-blscfg-module-for-legacy-.patch (100%) rename 0252-Fix-getroot.c-s-trampolines.patch => 0251-Fix-getroot.c-s-trampolines.patch (100%) rename 0253-Do-not-allow-stack-trampolines-anywhere.patch => 0252-Do-not-allow-stack-trampolines-anywhere.patch (100%) create mode 100644 0253-Reimplement-boot_counter.patch delete mode 100644 0254-Fix-boot-counting-grub.cfg-snippet-creation.patch delete mode 100644 0255-Fix-the-fallback-counting-script-even-harder.patch diff --git a/0216-Boot-Counting.patch b/0216-Boot-Counting.patch deleted file mode 100644 index 55fc375..0000000 --- a/0216-Boot-Counting.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Christian Glombek -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 diff --git a/0217-efinet-also-use-the-firmware-acceleration-for-http.patch b/0216-efinet-also-use-the-firmware-acceleration-for-http.patch similarity index 100% rename from 0217-efinet-also-use-the-firmware-acceleration-for-http.patch rename to 0216-efinet-also-use-the-firmware-acceleration-for-http.patch diff --git a/0218-efi-http-Make-root_url-reflect-the-protocol-hostname.patch b/0217-efi-http-Make-root_url-reflect-the-protocol-hostname.patch similarity index 100% rename from 0218-efi-http-Make-root_url-reflect-the-protocol-hostname.patch rename to 0217-efi-http-Make-root_url-reflect-the-protocol-hostname.patch diff --git a/0219-Disable-multiboot-multiboot2-and-linux16-modules-on-.patch b/0218-Disable-multiboot-multiboot2-and-linux16-modules-on-.patch similarity index 100% rename from 0219-Disable-multiboot-multiboot2-and-linux16-modules-on-.patch rename to 0218-Disable-multiboot-multiboot2-and-linux16-modules-on-.patch diff --git a/0220-Force-everything-to-use-python3.patch b/0219-Force-everything-to-use-python3.patch similarity index 100% rename from 0220-Force-everything-to-use-python3.patch rename to 0219-Force-everything-to-use-python3.patch diff --git a/0221-Fix-an-8-year-old-typo.patch b/0220-Fix-an-8-year-old-typo.patch similarity index 100% rename from 0221-Fix-an-8-year-old-typo.patch rename to 0220-Fix-an-8-year-old-typo.patch diff --git a/0222-autogen-don-t-run-autoreconf-in-the-topdir.patch b/0221-autogen-don-t-run-autoreconf-in-the-topdir.patch similarity index 100% rename from 0222-autogen-don-t-run-autoreconf-in-the-topdir.patch rename to 0221-autogen-don-t-run-autoreconf-in-the-topdir.patch diff --git a/0223-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch b/0222-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch similarity index 100% rename from 0223-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch rename to 0222-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch diff --git a/0224-module-verifier-make-it-possible-to-run-checkers-on-.patch b/0223-module-verifier-make-it-possible-to-run-checkers-on-.patch similarity index 100% rename from 0224-module-verifier-make-it-possible-to-run-checkers-on-.patch rename to 0223-module-verifier-make-it-possible-to-run-checkers-on-.patch diff --git a/0225-grub-module-verifier-report-the-filename-or-modname-.patch b/0224-grub-module-verifier-report-the-filename-or-modname-.patch similarity index 100% rename from 0225-grub-module-verifier-report-the-filename-or-modname-.patch rename to 0224-grub-module-verifier-report-the-filename-or-modname-.patch diff --git a/0226-Make-efi_netfs-not-duplicate-symbols-from-efinet.patch b/0225-Make-efi_netfs-not-duplicate-symbols-from-efinet.patch similarity index 100% rename from 0226-Make-efi_netfs-not-duplicate-symbols-from-efinet.patch rename to 0225-Make-efi_netfs-not-duplicate-symbols-from-efinet.patch diff --git a/0227-Rework-how-the-fdt-command-builds.patch b/0226-Rework-how-the-fdt-command-builds.patch similarity index 100% rename from 0227-Rework-how-the-fdt-command-builds.patch rename to 0226-Rework-how-the-fdt-command-builds.patch diff --git a/0228-Disable-non-wordsize-allocations-on-arm.patch b/0227-Disable-non-wordsize-allocations-on-arm.patch similarity index 100% rename from 0228-Disable-non-wordsize-allocations-on-arm.patch rename to 0227-Disable-non-wordsize-allocations-on-arm.patch diff --git a/0229-strip-R-.note.gnu.property-at-more-places.patch b/0228-strip-R-.note.gnu.property-at-more-places.patch similarity index 100% rename from 0229-strip-R-.note.gnu.property-at-more-places.patch rename to 0228-strip-R-.note.gnu.property-at-more-places.patch diff --git a/0230-Prepend-prefix-when-HTTP-path-is-relative.patch b/0229-Prepend-prefix-when-HTTP-path-is-relative.patch similarity index 100% rename from 0230-Prepend-prefix-when-HTTP-path-is-relative.patch rename to 0229-Prepend-prefix-when-HTTP-path-is-relative.patch diff --git a/0231-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch b/0230-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch similarity index 100% rename from 0231-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch rename to 0230-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch diff --git a/0232-Mark-some-unused-stuff-unused.patch b/0231-Mark-some-unused-stuff-unused.patch similarity index 100% rename from 0232-Mark-some-unused-stuff-unused.patch rename to 0231-Mark-some-unused-stuff-unused.patch diff --git a/0233-Make-grub_error-more-verbose.patch b/0232-Make-grub_error-more-verbose.patch similarity index 100% rename from 0233-Make-grub_error-more-verbose.patch rename to 0232-Make-grub_error-more-verbose.patch diff --git a/0234-Make-reset-an-alias-for-the-reboot-command.patch b/0233-Make-reset-an-alias-for-the-reboot-command.patch similarity index 100% rename from 0234-Make-reset-an-alias-for-the-reboot-command.patch rename to 0233-Make-reset-an-alias-for-the-reboot-command.patch diff --git a/0235-EFI-more-debug-output-on-GOP-and-UGA-probing.patch b/0234-EFI-more-debug-output-on-GOP-and-UGA-probing.patch similarity index 100% rename from 0235-EFI-more-debug-output-on-GOP-and-UGA-probing.patch rename to 0234-EFI-more-debug-output-on-GOP-and-UGA-probing.patch diff --git a/0236-Add-a-version-command.patch b/0235-Add-a-version-command.patch similarity index 100% rename from 0236-Add-a-version-command.patch rename to 0235-Add-a-version-command.patch diff --git a/0237-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch b/0236-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch similarity index 100% rename from 0237-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch rename to 0236-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch diff --git a/0238-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0237-arm-arm64-loader-Better-memory-allocation-and-error-.patch similarity index 100% rename from 0238-arm-arm64-loader-Better-memory-allocation-and-error-.patch rename to 0237-arm-arm64-loader-Better-memory-allocation-and-error-.patch diff --git a/0239-Try-to-pick-better-locations-for-kernel-and-initrd.patch b/0238-Try-to-pick-better-locations-for-kernel-and-initrd.patch similarity index 100% rename from 0239-Try-to-pick-better-locations-for-kernel-and-initrd.patch rename to 0238-Try-to-pick-better-locations-for-kernel-and-initrd.patch diff --git a/0240-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch b/0239-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch similarity index 100% rename from 0240-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch rename to 0239-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch diff --git a/0241-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch b/0240-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch similarity index 100% rename from 0241-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch rename to 0240-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch diff --git a/0242-grub-boot-success.timer-Add-a-few-Conditions-for-run.patch b/0241-grub-boot-success.timer-Add-a-few-Conditions-for-run.patch similarity index 100% rename from 0242-grub-boot-success.timer-Add-a-few-Conditions-for-run.patch rename to 0241-grub-boot-success.timer-Add-a-few-Conditions-for-run.patch diff --git a/0243-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch b/0242-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch similarity index 100% rename from 0243-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch rename to 0242-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch diff --git a/0244-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch b/0243-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch similarity index 100% rename from 0244-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch rename to 0243-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch diff --git a/0245-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch b/0244-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch similarity index 100% rename from 0245-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch rename to 0244-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch diff --git a/0246-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch b/0245-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch similarity index 100% rename from 0246-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch rename to 0245-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch diff --git a/0247-docs-Stop-using-polkit-pkexec-for-grub-boot-success..patch b/0246-docs-Stop-using-polkit-pkexec-for-grub-boot-success..patch similarity index 100% rename from 0247-docs-Stop-using-polkit-pkexec-for-grub-boot-success..patch rename to 0246-docs-Stop-using-polkit-pkexec-for-grub-boot-success..patch diff --git a/0248-drop-TPM-support-for-legacy-BIOS.patch b/0247-drop-TPM-support-for-legacy-BIOS.patch similarity index 100% rename from 0248-drop-TPM-support-for-legacy-BIOS.patch rename to 0247-drop-TPM-support-for-legacy-BIOS.patch diff --git a/0249-Move-quicksort-function-from-kernel.exec-to-the-blsc.patch b/0248-Move-quicksort-function-from-kernel.exec-to-the-blsc.patch similarity index 100% rename from 0249-Move-quicksort-function-from-kernel.exec-to-the-blsc.patch rename to 0248-Move-quicksort-function-from-kernel.exec-to-the-blsc.patch diff --git a/0250-Include-blscfg-module-for-powerpc-ieee1275.patch b/0249-Include-blscfg-module-for-powerpc-ieee1275.patch similarity index 100% rename from 0250-Include-blscfg-module-for-powerpc-ieee1275.patch rename to 0249-Include-blscfg-module-for-powerpc-ieee1275.patch diff --git a/0251-grub-switch-to-blscfg-copy-blscfg-module-for-legacy-.patch b/0250-grub-switch-to-blscfg-copy-blscfg-module-for-legacy-.patch similarity index 100% rename from 0251-grub-switch-to-blscfg-copy-blscfg-module-for-legacy-.patch rename to 0250-grub-switch-to-blscfg-copy-blscfg-module-for-legacy-.patch diff --git a/0252-Fix-getroot.c-s-trampolines.patch b/0251-Fix-getroot.c-s-trampolines.patch similarity index 100% rename from 0252-Fix-getroot.c-s-trampolines.patch rename to 0251-Fix-getroot.c-s-trampolines.patch diff --git a/0253-Do-not-allow-stack-trampolines-anywhere.patch b/0252-Do-not-allow-stack-trampolines-anywhere.patch similarity index 100% rename from 0253-Do-not-allow-stack-trampolines-anywhere.patch rename to 0252-Do-not-allow-stack-trampolines-anywhere.patch diff --git a/0253-Reimplement-boot_counter.patch b/0253-Reimplement-boot_counter.patch new file mode 100644 index 0000000..c0a3b84 --- /dev/null +++ b/0253-Reimplement-boot_counter.patch @@ -0,0 +1,187 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 4 Oct 2018 14:22:09 -0400 +Subject: [PATCH] Reimplement boot_counter + +This adds "increment" and "decrement" commands, and uses them to maintain our +variables in 01_fallback_counter. It also simplifies the counter logic, so +that there are no nested tests that conflict with each other. + +Apparently, this *really* wasn't tested well enough. + +Resolves: rhbz#1614637 +Signed-off-by: Peter Jones +--- + Makefile.util.def | 6 +++ + grub-core/Makefile.core.def | 5 ++ + grub-core/commands/increment.c | 105 ++++++++++++++++++++++++++++++++++++ + util/grub.d/01_fallback_counting.in | 15 ++++++ + 4 files changed, 131 insertions(+) + create mode 100644 grub-core/commands/increment.c + 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/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index 30c2ac8f3c8..826e27af900 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -362,6 +362,11 @@ kernel = { + extra_dist = kern/mips/cache_flush.S; + }; + ++module = { ++ name = increment; ++ common = commands/increment.c; ++}; ++ + program = { + name = grub-emu; + mansection = 1; +diff --git a/grub-core/commands/increment.c b/grub-core/commands/increment.c +new file mode 100644 +index 00000000000..79cf137656c +--- /dev/null ++++ b/grub-core/commands/increment.c +@@ -0,0 +1,105 @@ ++/* increment.c - Commands to increment and decrement variables. */ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. ++ * ++ * GRUB is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation, either version 3 of the License, or ++ * (at your option) any later version. ++ * ++ * GRUB is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GRUB. If not, see . ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++GRUB_MOD_LICENSE ("GPLv3+"); ++ ++typedef enum { ++ INCREMENT, ++ DECREMENT, ++} operation; ++ ++static grub_err_t ++incr_decr(operation op, int argc, char **args) ++{ ++ const char *old; ++ char *new; ++ long value; ++ ++ if (argc < 1) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("no variable specified")); ++ if (argc > 1) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("too many arguments")); ++ ++ old = grub_env_get (*args); ++ if (!old) ++ return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("No such variable \"%s\""), ++ *args); ++ ++ value = grub_strtol (old, NULL, 0); ++ if (grub_errno != GRUB_ERR_NONE) ++ return grub_errno; ++ ++ switch (op) ++ { ++ case INCREMENT: ++ value += 1; ++ break; ++ case DECREMENT: ++ value -= 1; ++ break; ++ } ++ ++ new = grub_xasprintf ("%ld", value); ++ if (!new) ++ return grub_errno; ++ ++ grub_env_set (*args, new); ++ grub_free (new); ++ ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t ++grub_cmd_incr(struct grub_command *cmd UNUSED, ++ int argc, char **args) ++{ ++ return incr_decr(INCREMENT, argc, args); ++} ++ ++static grub_err_t ++grub_cmd_decr(struct grub_command *cmd UNUSED, ++ int argc, char **args) ++{ ++ return incr_decr(DECREMENT, argc, args); ++} ++ ++static grub_command_t cmd_incr, cmd_decr; ++ ++GRUB_MOD_INIT(increment) ++{ ++ cmd_incr = grub_register_command ("increment", grub_cmd_incr, N_("VARIABLE"), ++ N_("increment VARIABLE")); ++ cmd_decr = grub_register_command ("decrement", grub_cmd_decr, N_("VARIABLE"), ++ N_("decrement VARIABLE")); ++} ++ ++GRUB_MOD_FINI(increment) ++{ ++ grub_unregister_command (cmd_incr); ++ grub_unregister_command (cmd_decr); ++} +diff --git a/util/grub.d/01_fallback_counting.in b/util/grub.d/01_fallback_counting.in +new file mode 100644 +index 00000000000..6ca13da03df +--- /dev/null ++++ b/util/grub.d/01_fallback_counting.in +@@ -0,0 +1,15 @@ ++#! /bin/sh -e ++ ++# Boot Counting ++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 ++fi ++save_env boot_counter ++EOF diff --git a/0254-Fix-boot-counting-grub.cfg-snippet-creation.patch b/0254-Fix-boot-counting-grub.cfg-snippet-creation.patch deleted file mode 100644 index bbc92ff..0000000 --- a/0254-Fix-boot-counting-grub.cfg-snippet-creation.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Christian Glombek -Date: Tue, 2 Oct 2018 15:41:18 +0200 -Subject: [PATCH] Fix boot counting grub.cfg snippet creation Fixes BZ1614637 - ---- - util/grub.d/01_fallback_counting.in | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/util/grub.d/01_fallback_counting.in b/util/grub.d/01_fallback_counting.in -index ecfc7401474..afe06199a93 100644 ---- a/util/grub.d/01_fallback_counting.in -+++ b/util/grub.d/01_fallback_counting.in -@@ -1,6 +1,7 @@ - #! /bin/sh -e - - # Boot Counting -+cat << EOF - if [ "\${boot_counter}" -a "\${boot_success}" = "0" ]; then - if [ "\${boot_counter}" = "0" -o "\${boot_counter}" = "-1" ]; then - set default=1 -@@ -10,3 +11,4 @@ if [ "\${boot_counter}" -a "\${boot_success}" = "0" ]; then - fi - save_env boot_counter - fi -+EOF -\ No newline at end of file diff --git a/0255-Fix-the-fallback-counting-script-even-harder.patch b/0255-Fix-the-fallback-counting-script-even-harder.patch deleted file mode 100644 index a478685..0000000 --- a/0255-Fix-the-fallback-counting-script-even-harder.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Wed, 3 Oct 2018 15:53:18 -0400 -Subject: [PATCH] Fix the fallback counting script even harder. - -Apparently, this wasn't tested well enough. - -Resolves: rhbz#1614637 -Signed-off-by: Peter Jones ---- - util/grub.d/01_fallback_counting.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/util/grub.d/01_fallback_counting.in b/util/grub.d/01_fallback_counting.in -index afe06199a93..31e8981887b 100644 ---- a/util/grub.d/01_fallback_counting.in -+++ b/util/grub.d/01_fallback_counting.in -@@ -7,8 +7,8 @@ if [ "\${boot_counter}" -a "\${boot_success}" = "0" ]; then - set default=1 - set boot_counter=-1 - else -- set boot_counter=$((\${boot_counter}-1)) -+ set boot_counter=\$((\${boot_counter}-1)) - fi - save_env boot_counter - fi --EOF -\ No newline at end of file -+EOF diff --git a/grub.macros b/grub.macros index ba606d0..d15bd25 100644 --- a/grub.macros +++ b/grub.macros @@ -368,7 +368,7 @@ GRUB_MODULES=" all_video boot blscfg btrfs \\\ cat configfile \\\ echo efi_netfs efifwsetup efinet ext2 \\\ fat font gfxmenu gfxterm gzio \\\ - halt hfsplus http iso9660 jpeg \\\ + halt hfsplus http increment iso9660 jpeg \\\ loadenv loopback linux lvm lsefi lsefimmap \\\ mdraid09 mdraid1x minicmd net \\\ normal part_apple part_msdos part_gpt \\\ diff --git a/grub.patches b/grub.patches index b520493..91d34c0 100644 --- a/grub.patches +++ b/grub.patches @@ -213,43 +213,41 @@ Patch0212: 0212-blscfg-Fallback-to-search-BLS-snippets-in-boot-loade.patch Patch0213: 0213-blscfg-Don-t-attempt-to-sort-by-version-if-not-prese.patch Patch0214: 0214-blscfg-remove-logic-to-read-the-grubenv-file-and-set.patch Patch0215: 0215-Rename-00_menu_auto_hide.in-to-01_menu_auto_hide.in.patch -Patch0216: 0216-Boot-Counting.patch -Patch0217: 0217-efinet-also-use-the-firmware-acceleration-for-http.patch -Patch0218: 0218-efi-http-Make-root_url-reflect-the-protocol-hostname.patch -Patch0219: 0219-Disable-multiboot-multiboot2-and-linux16-modules-on-.patch -Patch0220: 0220-Force-everything-to-use-python3.patch -Patch0221: 0221-Fix-an-8-year-old-typo.patch -Patch0222: 0222-autogen-don-t-run-autoreconf-in-the-topdir.patch -Patch0223: 0223-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch -Patch0224: 0224-module-verifier-make-it-possible-to-run-checkers-on-.patch -Patch0225: 0225-grub-module-verifier-report-the-filename-or-modname-.patch -Patch0226: 0226-Make-efi_netfs-not-duplicate-symbols-from-efinet.patch -Patch0227: 0227-Rework-how-the-fdt-command-builds.patch -Patch0228: 0228-Disable-non-wordsize-allocations-on-arm.patch -Patch0229: 0229-strip-R-.note.gnu.property-at-more-places.patch -Patch0230: 0230-Prepend-prefix-when-HTTP-path-is-relative.patch -Patch0231: 0231-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch -Patch0232: 0232-Mark-some-unused-stuff-unused.patch -Patch0233: 0233-Make-grub_error-more-verbose.patch -Patch0234: 0234-Make-reset-an-alias-for-the-reboot-command.patch -Patch0235: 0235-EFI-more-debug-output-on-GOP-and-UGA-probing.patch -Patch0236: 0236-Add-a-version-command.patch -Patch0237: 0237-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch -Patch0238: 0238-arm-arm64-loader-Better-memory-allocation-and-error-.patch -Patch0239: 0239-Try-to-pick-better-locations-for-kernel-and-initrd.patch -Patch0240: 0240-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch -Patch0241: 0241-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch -Patch0242: 0242-grub-boot-success.timer-Add-a-few-Conditions-for-run.patch -Patch0243: 0243-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch -Patch0244: 0244-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch -Patch0245: 0245-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch -Patch0246: 0246-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch -Patch0247: 0247-docs-Stop-using-polkit-pkexec-for-grub-boot-success..patch -Patch0248: 0248-drop-TPM-support-for-legacy-BIOS.patch -Patch0249: 0249-Move-quicksort-function-from-kernel.exec-to-the-blsc.patch -Patch0250: 0250-Include-blscfg-module-for-powerpc-ieee1275.patch -Patch0251: 0251-grub-switch-to-blscfg-copy-blscfg-module-for-legacy-.patch -Patch0252: 0252-Fix-getroot.c-s-trampolines.patch -Patch0253: 0253-Do-not-allow-stack-trampolines-anywhere.patch -Patch0254: 0254-Fix-boot-counting-grub.cfg-snippet-creation.patch -Patch0255: 0255-Fix-the-fallback-counting-script-even-harder.patch +Patch0216: 0216-efinet-also-use-the-firmware-acceleration-for-http.patch +Patch0217: 0217-efi-http-Make-root_url-reflect-the-protocol-hostname.patch +Patch0218: 0218-Disable-multiboot-multiboot2-and-linux16-modules-on-.patch +Patch0219: 0219-Force-everything-to-use-python3.patch +Patch0220: 0220-Fix-an-8-year-old-typo.patch +Patch0221: 0221-autogen-don-t-run-autoreconf-in-the-topdir.patch +Patch0222: 0222-Make-it-so-we-can-tell-configure-which-cflags-utils-.patch +Patch0223: 0223-module-verifier-make-it-possible-to-run-checkers-on-.patch +Patch0224: 0224-grub-module-verifier-report-the-filename-or-modname-.patch +Patch0225: 0225-Make-efi_netfs-not-duplicate-symbols-from-efinet.patch +Patch0226: 0226-Rework-how-the-fdt-command-builds.patch +Patch0227: 0227-Disable-non-wordsize-allocations-on-arm.patch +Patch0228: 0228-strip-R-.note.gnu.property-at-more-places.patch +Patch0229: 0229-Prepend-prefix-when-HTTP-path-is-relative.patch +Patch0230: 0230-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch +Patch0231: 0231-Mark-some-unused-stuff-unused.patch +Patch0232: 0232-Make-grub_error-more-verbose.patch +Patch0233: 0233-Make-reset-an-alias-for-the-reboot-command.patch +Patch0234: 0234-EFI-more-debug-output-on-GOP-and-UGA-probing.patch +Patch0235: 0235-Add-a-version-command.patch +Patch0236: 0236-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch +Patch0237: 0237-arm-arm64-loader-Better-memory-allocation-and-error-.patch +Patch0238: 0238-Try-to-pick-better-locations-for-kernel-and-initrd.patch +Patch0239: 0239-Attempt-to-fix-up-all-the-places-Wsign-compare-error.patch +Patch0240: 0240-Don-t-use-Wno-sign-compare-Wno-conversion-Wno-error-.patch +Patch0241: 0241-grub-boot-success.timer-Add-a-few-Conditions-for-run.patch +Patch0242: 0242-x86-efi-Use-bounce-buffers-for-reading-to-addresses-.patch +Patch0243: 0243-x86-efi-Re-arrange-grub_cmd_linux-a-little-bit.patch +Patch0244: 0244-x86-efi-Make-our-own-allocator-for-kernel-stuff.patch +Patch0245: 0245-x86-efi-Allow-initrd-params-cmdline-allocations-abov.patch +Patch0246: 0246-docs-Stop-using-polkit-pkexec-for-grub-boot-success..patch +Patch0247: 0247-drop-TPM-support-for-legacy-BIOS.patch +Patch0248: 0248-Move-quicksort-function-from-kernel.exec-to-the-blsc.patch +Patch0249: 0249-Include-blscfg-module-for-powerpc-ieee1275.patch +Patch0250: 0250-grub-switch-to-blscfg-copy-blscfg-module-for-legacy-.patch +Patch0251: 0251-Fix-getroot.c-s-trampolines.patch +Patch0252: 0252-Do-not-allow-stack-trampolines-anywhere.patch +Patch0253: 0253-Reimplement-boot_counter.patch diff --git a/grub2.spec b/grub2.spec index e57947e..0f61083 100644 --- a/grub2.spec +++ b/grub2.spec @@ -7,7 +7,7 @@ Name: grub2 Epoch: 1 Version: 2.02 -Release: 61%{?dist} +Release: 62%{?dist} Summary: Bootloader with support for Linux, Multiboot and more Group: System Environment/Base License: GPLv3+ @@ -386,6 +386,7 @@ fi %files tools %attr(0644,root,root) %ghost %config(noreplace) %{_sysconfdir}/default/grub %config %{_sysconfdir}/grub.d/??_* +%exclude %{_sysconfdir}/grub.d/01_fallback_counting %{_sysconfdir}/grub.d/README %{_userunitdir}/grub-boot-success.timer %{_userunitdir}/grub-boot-success.service @@ -494,6 +495,11 @@ fi %endif %changelog +* Thu Oct 04 2018 Peter Jones - 2.02-62 +- Exclude /etc/grub.d/01_fallback_counting until we work through some design + questions. + Resolves: rhbz#1614637 + * Wed Oct 03 2018 Peter Jones - 2.02-61 - Fix the fallback counting script even harder. Apparently, this wasn't tested well enough.