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

Resolves: RHEL-61745
This commit is contained in:
Petr Písař 2024-10-10 15:53:17 +02:00
parent 7d13817a6a
commit 771209444a
2 changed files with 46 additions and 2 deletions

View File

@ -0,0 +1,40 @@
From fdeb208b7b6522bd458142867683b1bf68cd355d 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-61745
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 36cfa74b5..3dc08d616 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

@ -69,7 +69,7 @@ It supports RPMs, modules and comps groups & environments.
Name: dnf
Version: 4.14.0
Release: 19%{?dist}
Release: 20%{?dist}
Summary: %{pkg_summary}
# For a breakdown of the licensing, see PACKAGE-LICENSING
License: GPLv2+
@ -106,7 +106,7 @@ Patch28: 0028-Update-ostree-bootc-host-system-check.patch
Patch29: 0029-Update-bootc-hosts-message-to-point-to-bootc-help.patch
Patch30: 0030-Allow-installroot-on-read-only-bootc-system.patch
Patch31: 0031-smtplib-catch-OSError-not-SMTPException.patch
Patch32: 0032-Allow-downloadonly-on-read-only-bootc-system.patch
BuildArch: noarch
BuildRequires: cmake
@ -395,6 +395,10 @@ popd
%{python3_sitelib}/%{name}/automatic/
%changelog
* Thu Oct 10 2024 Petr Pisar <ppisar@redhat.com> - 4.14.0-20
- Allow "dnf install --downloadonly" on locked OSTree and bootc systems
(RHEL-61745)
* Mon Oct 07 2024 Marek Blaha <mblaha@redhat.com> - 4.14.0-19
- Catch more specific OSError instead of SMTPException in dnf-automatic email
emitter (RHEL-49743)