diff --git a/dnf/cli/cli.py b/dnf/cli/cli.py index 83b1900260..66fab07dc0 100644 --- a/dnf/cli/cli.py +++ b/dnf/cli/cli.py @@ -215,7 +215,13 @@ def do_transaction(self, display=()): 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(): - _bootc_host_msg = _(""" + bootc_docs = dnf.util._bootc_doc_url() + if bootc_docs: + _bootc_host_msg = _(""" +*** Error: system is configured to be read-only; for more +*** information see: """ + dnf.util._bootc_doc_url()) + else: + _bootc_host_msg = _(""" *** Error: system is configured to be read-only; for more *** information run `bootc status` or `ostree admin status`. """) diff --git a/dnf/util.py b/dnf/util.py index 54cbf8945c..66f0250046 100644 --- a/dnf/util.py +++ b/dnf/util.py @@ -656,3 +656,12 @@ def _is_bootc_host(): # temporary changes (until reboot). return os.path.isfile(ostree_booted) and not os.access(usr, os.W_OK) + +def _bootc_doc_url(): + try: + with open('/etc/os-release', 'r') as f: + for line in f: + if line.startswith('BOOTC_HOST_DOC='): + return line.split('=')[1].strip().strip('"') + except Exception as e: + return None