diff --git a/0002-man-Fix-line-starting-with.patch b/0001-man-Fix-line-starting-with.patch similarity index 68% rename from 0002-man-Fix-line-starting-with.patch rename to 0001-man-Fix-line-starting-with.patch index f747576..e1349e0 100644 --- a/0002-man-Fix-line-starting-with.patch +++ b/0001-man-Fix-line-starting-with.patch @@ -1,3 +1,13 @@ +From 841e7d3d0dc7ad194e0b82d8cd0930cef1a95301 Mon Sep 17 00:00:00 2001 +From: Marian Csontos +Date: Fri, 29 Nov 2019 10:23:44 +0100 +Subject: [PATCH 1/5] man: Fix line starting with ' + +Lines starting with ' result in macro not defined warnings: + + 1117: warning: macro `boom' not defined + 1118: warning: macro `+'' not defined +--- man/man8/boom.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) @@ -16,3 +26,6 @@ index 7b862e7..9eee048 100644 field list. Otherwise the given list of fields replaces the default set of report fields. +-- +2.34.3 + diff --git a/0002-boom.bootloader-initialise-_last_path-before-parsing.patch b/0002-boom.bootloader-initialise-_last_path-before-parsing.patch new file mode 100644 index 0000000..1c303fa --- /dev/null +++ b/0002-boom.bootloader-initialise-_last_path-before-parsing.patch @@ -0,0 +1,43 @@ +From a3e33031fb4051eb9d76f950b536b513c58be861 Mon Sep 17 00:00:00 2001 +From: "Bryn M. Reeves" +Date: Tue, 14 Jun 2022 07:47:04 -0400 +Subject: [PATCH 2/5] boom.bootloader: initialise _last_path before parsing + BootEntry + +The path from which a boot entry was read can be useful context for +logging messages, particularly when a boot entry has been corrupted or +manually edited (so that the boot_id no longer matches the expected +value). + +Move the initialisation of this member before parsing the boot entry, so +that the value is available for log messages. + +Signed-off-by: Bryn M. Reeves +(cherry picked from commit fafa77556e442fe4f016c23eb9739f1015fa9eb8) +--- + boom/bootloader.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/boom/bootloader.py b/boom/bootloader.py +index aa9131f..185195d 100644 +--- a/boom/bootloader.py ++++ b/boom/bootloader.py +@@ -1484,6 +1484,7 @@ class BootEntry(object): + + entry_basename = basename(entry_file) + _log_debug("Loading BootEntry from '%s'" % entry_basename) ++ self._last_path = entry_file + + with open(entry_file, "r") as ef: + for line in ef: +@@ -1536,7 +1537,6 @@ class BootEntry(object): + entry_basename) + self.read_only = True + +- self._last_path = entry_file + self._unwritten = False + + def __init__(self, title=None, machine_id=None, osprofile=None, +-- +2.34.3 + diff --git a/0003-boom.bootloader-improve-warning-for-entries-with-no-.patch b/0003-boom.bootloader-improve-warning-for-entries-with-no-.patch new file mode 100644 index 0000000..a593aa4 --- /dev/null +++ b/0003-boom.bootloader-improve-warning-for-entries-with-no-.patch @@ -0,0 +1,47 @@ +From faf43a2b923dd2e558da1e48978541389844f464 Mon Sep 17 00:00:00 2001 +From: "Bryn M. Reeves" +Date: Tue, 14 Jun 2022 07:50:11 -0400 +Subject: [PATCH 3/5] boom.bootloader: improve warning for entries with no + root_device + +A boot entry with no root_device= is invalid. Log the path to the file +rather than the boot_id since this may have changed if the entry is +corrupt/modified, and is not included in the file name for system +provided boot entries. + +Signed-off-by: Bryn M. Reeves +(cherry picked from commit b70d2ad6a4b8f7ef7816426bcb18b6f247a52dca) +--- + boom/bootloader.py | 3 +-- + tests/bootloader_tests.py | 1 + + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/boom/bootloader.py b/boom/bootloader.py +index 185195d..bbf7fd5 100644 +--- a/boom/bootloader.py ++++ b/boom/bootloader.py +@@ -720,8 +720,7 @@ class BootParams(object): + # The root_device key is handled specially since it is required + # for a valid BootEntry. + if name == 'root_device' and not value: +- _log_warn("Entry with boot_id=%s has no root_device" +- % be.boot_id) ++ _log_warn("No root_device for entry at %s" % be._last_path) + setattr(bp, name, "") + + def is_add(opt): +diff --git a/tests/bootloader_tests.py b/tests/bootloader_tests.py +index 129000d..ace82bd 100644 +--- a/tests/bootloader_tests.py ++++ b/tests/bootloader_tests.py +@@ -158,6 +158,7 @@ class MockBootEntry(object): + expand_options = "root=/dev/mapper/rhel-root ro rhgb quiet" + _osp = None + _entry_data = {} ++ _last_path = "/some/path/to/somewhere" + + + class BootEntryBasicTests(unittest.TestCase): +-- +2.34.3 + diff --git a/0004-boom.bootloader-do-not-allow-deletion-of-read-only-b.patch b/0004-boom.bootloader-do-not-allow-deletion-of-read-only-b.patch new file mode 100644 index 0000000..b99b926 --- /dev/null +++ b/0004-boom.bootloader-do-not-allow-deletion-of-read-only-b.patch @@ -0,0 +1,46 @@ +From 31f95734f0d6f90f256754377207f5373ff9015c Mon Sep 17 00:00:00 2001 +From: "Bryn M. Reeves" +Date: Tue, 14 Jun 2022 07:54:29 -0400 +Subject: [PATCH 4/5] boom.bootloader: do not allow deletion of read-only boot + entries + +Currently when attempting to delete an entry that has been marked +read-only boom generates a misleading error message: + + # boom delete 7fce1e5 + Entry does not exist: /boot/loader/entries/619c4d9f1efa4cf7bd76f149f12138a0-7fce1e5-5.14.0-108.el9.x86_64.conf + +Boom should not attempt to delete entries that are marked read-only; +these are either system provided entries, or entries that have been +modified outside of boom's control. Reject attempts to delete these +with an error that indicates the reason they cannot be removed: + + # boom delete f6f8df5 + Cannot delete read-only boot entry: /boot/loader/entries/68f613d8774e41e792fad28212cfedae-4.18.0-348.el8.x86_64.conf + +Resolves: #10 + +Signed-off-by: Bryn M. Reeves +(cherry picked from commit 42f66737e1d7dec432cd7fc330f87304a585c308) +--- + boom/bootloader.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/boom/bootloader.py b/boom/bootloader.py +index bbf7fd5..a81ea84 100644 +--- a/boom/bootloader.py ++++ b/boom/bootloader.py +@@ -2445,6 +2445,10 @@ class BootEntry(object): + :raises: ``OsError`` if an error occurs removing the file or + ``ValueError`` if the entry does not exist. + """ ++ if self.read_only: ++ raise ValueError("Cannot delete read-only boot " ++ "entry: %s" % self._last_path) ++ + if not path_exists(self._entry_path): + raise ValueError("Entry does not exist: %s" % self._entry_path) + try: +-- +2.34.3 + diff --git a/0005-boom.command-add-new-os-release-values-to-Red-Hat-op.patch b/0005-boom.command-add-new-os-release-values-to-Red-Hat-op.patch new file mode 100644 index 0000000..6f08094 --- /dev/null +++ b/0005-boom.command-add-new-os-release-values-to-Red-Hat-op.patch @@ -0,0 +1,35 @@ +From cd0c4e28b0b2de9000edd5b4b56612d610337552 Mon Sep 17 00:00:00 2001 +From: "Bryn M. Reeves" +Date: Tue, 14 Jun 2022 09:31:33 -0400 +Subject: [PATCH 5/5] boom.command: add new os-release values to Red Hat + optional keys list + +Add "Red Hat Enterprise Linux" (NAME for el8 onwards), and "Fedora +Linux" (NAME for fc35 onwards) to the table of names to automatically +enable grub optional keys for. + +Signed-off-by: Bryn M. Reeves +(cherry picked from commit 0cb2d8da9de6fa01ebc5193e7ab6710a9c7b7125) +--- + boom/command.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/boom/command.py b/boom/command.py +index 0ef66ee..07c0616 100644 +--- a/boom/command.py ++++ b/boom/command.py +@@ -1094,9 +1094,11 @@ def _default_optional_keys(osp): + """ + all_optional_keys = "grub_users grub_arg grub_class id" + _default_optional_keys = [ ++ "Red Hat Enterprise Linux", + "Red Hat Enterprise Linux Server", + "Red Hat Enterprise Linux Workstation", + "CentOS Linux", ++ "Fedora Linux", + "Fedora" + ] + if osp.os_name in _default_optional_keys: +-- +2.34.3 + diff --git a/boom-boot.spec b/boom-boot.spec index b48e855..596685b 100644 --- a/boom-boot.spec +++ b/boom-boot.spec @@ -3,13 +3,20 @@ Name: boom-boot Version: 1.4 -Release: 3%{?dist} +Release: 4%{?dist} Summary: %{summary} License: GPLv2 URL: https://github.com/snapshotmanager/boom Source0: https://github.com/snapshotmanager/boom/archive/%{version}/boom-%{version}.tar.gz -Patch1: 0002-man-Fix-line-starting-with.patch +Patch1: 0001-man-Fix-line-starting-with.patch +# Minor improvements: +Patch2: 0002-boom.bootloader-initialise-_last_path-before-parsing.patch +Patch3: 0003-boom.bootloader-improve-warning-for-entries-with-no-.patch +# BZ 2096447: +Patch4: 0004-boom.bootloader-do-not-allow-deletion-of-read-only-b.patch +# BZ 2096368: +Patch5: 0005-boom.command-add-new-os-release-values-to-Red-Hat-op.patch BuildArch: noarch @@ -76,6 +83,10 @@ This package provides configuration files for boom. %setup -n boom-%{version} # NOTE: Do not use backup extension - MANIFEST.in is picking them %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 %build %if 0%{?sphinx_docs} @@ -136,6 +147,10 @@ rm doc/conf.py %changelog +* Wed Jul 13 2022 Marian Csontos 1.4-4 +- Fix handling of read-only entries. +- Add OS names for recent versions. + * Tue May 24 2022 Marian Csontos 1.4-3 - Fix missing /boot/boom/profiles directory.