Allow "dnf install --downloadonly" on locked OSTree and bootc systems

Resolves: RHEL-62028
This commit is contained in:
Petr Písař 2024-10-15 17:00:11 +02:00
parent 6935c8626a
commit c2fe43eaf0
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From 86bc1d60e1b8188ca5a682974d734ac3a0cdc102 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
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ř <ppisar@redhat.com>
---
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

View File

@ -68,7 +68,7 @@ It supports RPMs, modules and comps groups & environments.
Name: dnf Name: dnf
Version: 4.20.0 Version: 4.20.0
Release: 7%{?dist} Release: 8%{?dist}
Summary: %{pkg_summary} Summary: %{pkg_summary}
# For a breakdown of the licensing, see PACKAGE-LICENSING # For a breakdown of the licensing, see PACKAGE-LICENSING
License: GPL-2.0-or-later AND GPL-1.0-only 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 Patch7: 0007-Update-ostree-bootc-host-system-check.patch
Patch8: 0008-Update-bootc-hosts-message-to-point-to-bootc-help.patch Patch8: 0008-Update-bootc-hosts-message-to-point-to-bootc-help.patch
Patch9: 0009-Allow-installroot-on-read-only-bootc-system.patch Patch9: 0009-Allow-installroot-on-read-only-bootc-system.patch
Patch10: 0010-Allow-downloadonly-on-read-only-bootc-system.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gettext BuildRequires: gettext
@ -423,6 +424,10 @@ popd
%{python3_sitelib}/%{name}/automatic/ %{python3_sitelib}/%{name}/automatic/
%changelog %changelog
* Tue Oct 15 2024 Petr Pisar <ppisar@redhat.com> - 4.20.0-8
- Allow "dnf install --downloadonly" on locked OSTree and bootc systems
(RHEL-62028)
* Fri Sep 20 2024 Petr Pisar <ppisar@redhat.com> - 4.20.0-7 * Fri Sep 20 2024 Petr Pisar <ppisar@redhat.com> - 4.20.0-7
- More specific error message on a locked OSTree system or a bootc system - More specific error message on a locked OSTree system or a bootc system
without a usr-overlay (RHEL-49671) without a usr-overlay (RHEL-49671)