Skip to content

Commit

Permalink
Allow --installroot on read-only bootc system
Browse files Browse the repository at this point in the history
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: rpm-software-management#2108
  • Loading branch information
ppisar committed Aug 15, 2024
1 parent b23e3fb commit 1d04129
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dnf/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down

0 comments on commit 1d04129

Please sign in to comment.