From ea79cd8c65e82a7e300288c5aef244690e633035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Thu, 15 Aug 2024 14:04:55 +0200 Subject: [PATCH] Allow --installroot on read-only bootc system Some people use --installroot on a read-only bootc system to install a system into a chroot subtree. However, current bootc check did not take into account --installroot and rejected the operation. This patch augments the check for a writable installroot being different from /. The comparison for / is there to deal with bootc systems with a writeable /. Currently it's uncerain whether systems like that exist. Resolves: #2108 --- dnf/cli/cli.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dnf/cli/cli.py b/dnf/cli/cli.py index 0eda2c8cb8..038d6be500 100644 --- a/dnf/cli/cli.py +++ b/dnf/cli/cli.py @@ -214,7 +214,9 @@ def do_transaction(self, display=()): elif 'test' in self.conf.tsflags: 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(): + if dnf.util._is_bootc_host() and \ + (os.path.realpath(self.conf.installroot) == "/" or + not os.access(self.conf.installroot, os.W_OK)): _bootc_host_msg = _(""" *** Error: system is configured to be read-only; for more *** information run `bootc --help`.