qvm-template: use UpdateVM by default

Do not hardcode sys-firewall
This commit is contained in:
Marek Marczykowski-Górecki 2021-01-29 22:42:57 +01:00
parent 1671b4216f
commit b500462abb
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 7 additions and 2 deletions

View File

@ -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

View File

@ -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)