From c2fe43eaf02fa21a3bc54b4c053a97ab72a609d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Tue, 15 Oct 2024 17:00:11 +0200 Subject: [PATCH] Allow "dnf install --downloadonly" on locked OSTree and bootc systems Resolves: RHEL-62028 --- ...wnloadonly-on-read-only-bootc-system.patch | 40 +++++++++++++++++++ dnf.spec | 7 +++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 0010-Allow-downloadonly-on-read-only-bootc-system.patch diff --git a/0010-Allow-downloadonly-on-read-only-bootc-system.patch b/0010-Allow-downloadonly-on-read-only-bootc-system.patch new file mode 100644 index 0000000..3f6b623 --- /dev/null +++ b/0010-Allow-downloadonly-on-read-only-bootc-system.patch @@ -0,0 +1,40 @@ +From 86bc1d60e1b8188ca5a682974d734ac3a0cdc102 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Thu, 10 Oct 2024 10:57:48 +0200 +Subject: [PATCH] Allow --downloadonly on read-only bootc system +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream commit: 8d888d26e6da27ba37243d7504eb42472f389bde + +"dnf install --downloadonly" failed on read-only bootc system despite +not running the transaction. The downloaded packages are stored under +writable /var or to a directory explicitly choosen by a user. + +This patch suppresses the bootc read-only bailout if --downloadonly +option is used. + +https://issues.redhat.com/browse/RHEL-62028 +Signed-off-by: Petr Písař +--- + dnf/cli/cli.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/dnf/cli/cli.py b/dnf/cli/cli.py +index 008262ea0..d3844df34 100644 +--- a/dnf/cli/cli.py ++++ b/dnf/cli/cli.py +@@ -215,7 +215,8 @@ class BaseCli(dnf.Base): + logger.info(_("{prog} will only download packages, install gpg keys, and check the " + "transaction.").format(prog=dnf.util.MAIN_PROG_UPPER)) + if dnf.util._is_bootc_host() and \ +- os.path.realpath(self.conf.installroot) == "/": ++ os.path.realpath(self.conf.installroot) == "/" and \ ++ not self.conf.downloadonly: + _bootc_host_msg = _(""" + *** Error: system is configured to be read-only; for more + *** information run `bootc --help`. +-- +2.47.0 + diff --git a/dnf.spec b/dnf.spec index 5570a1a..880fa6d 100644 --- a/dnf.spec +++ b/dnf.spec @@ -68,7 +68,7 @@ It supports RPMs, modules and comps groups & environments. Name: dnf Version: 4.20.0 -Release: 7%{?dist} +Release: 8%{?dist} Summary: %{pkg_summary} # For a breakdown of the licensing, see PACKAGE-LICENSING License: GPL-2.0-or-later AND GPL-1.0-only @@ -83,6 +83,7 @@ Patch6: 0006-Add-detection-for-ostree-based-systems-and-warn-user.patch Patch7: 0007-Update-ostree-bootc-host-system-check.patch Patch8: 0008-Update-bootc-hosts-message-to-point-to-bootc-help.patch Patch9: 0009-Allow-installroot-on-read-only-bootc-system.patch +Patch10: 0010-Allow-downloadonly-on-read-only-bootc-system.patch BuildArch: noarch BuildRequires: cmake BuildRequires: gettext @@ -423,6 +424,10 @@ popd %{python3_sitelib}/%{name}/automatic/ %changelog +* Tue Oct 15 2024 Petr Pisar - 4.20.0-8 +- Allow "dnf install --downloadonly" on locked OSTree and bootc systems + (RHEL-62028) + * Fri Sep 20 2024 Petr Pisar - 4.20.0-7 - More specific error message on a locked OSTree system or a bootc system without a usr-overlay (RHEL-49671)