From b500462abbe4f8818a176e8cce555907006333dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 29 Jan 2021 22:42:57 +0100 Subject: [PATCH] qvm-template: use UpdateVM by default Do not hardcode sys-firewall --- doc/manpages/qvm-template.rst | 2 +- qubesadmin/tools/qvm_template.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/manpages/qvm-template.rst b/doc/manpages/qvm-template.rst index 406f237..1bc179d 100644 --- a/doc/manpages/qvm-template.rst +++ b/doc/manpages/qvm-template.rst @@ -31,7 +31,7 @@ Options .. option:: --updatevm UPDATEVM Specify VM to download updates from. (Set to empty string to specify the - current VM.) (default: sys-firewall) + current VM.) (default: same as UpdateVM - see ``qubes-prefs``) .. option:: --enablerepo REPOID diff --git a/qubesadmin/tools/qvm_template.py b/qubesadmin/tools/qvm_template.py index dfc006b..05f74f9 100644 --- a/qubesadmin/tools/qvm_template.py +++ b/qubesadmin/tools/qvm_template.py @@ -37,6 +37,8 @@ UNVERIFIED_SUFFIX = '.unverified' LOCK_FILE = '/var/tmp/qvm-template.lck' DATE_FMT = '%Y-%m-%d %H:%M:%S' +UPDATEVM = str('global UpdateVM') + def qubes_release() -> str: """Return the Qubes release.""" if os.path.exists('/usr/share/qubes/marker-vm'): @@ -78,7 +80,7 @@ def parser_gen() -> argparse.ArgumentParser: parser_main.add_argument('--keyring', default='/usr/share/qubes/repo-templates/keys', help='Specify directory containing RPM public keys.') - parser_main.add_argument('--updatevm', default='sys-firewall', + parser_main.add_argument('--updatevm', default=UPDATEVM, help=('Specify VM to download updates from.' ' (Set to empty string to specify the current VM.)')) parser_main.add_argument('--enablerepo', action='append', default=[], @@ -1384,6 +1386,9 @@ def main(args: typing.Optional[typing.Sequence[str]] = None, if app is None: app = qubesadmin.Qubes() + if p_args.updatevm is UPDATEVM: + p_args.updatevm = app.updatevm + if p_args.refresh: qrexec_repoquery(p_args, app, refresh=True)