Skip to content

Commit 2965dd1

Browse files
committed
qvm-template: pass through --skip-start to qvm-template-postprocess
Allow skipping the post-installation qrexec service (which retrieves app menus and features), e.g. to keep the template in a pristine state from which multiple child templates can be cloned that will not be linkable to each other through volume data modifications (updated timestamps etc.) inherited from their parent. The post-installation service can be called later: qvm-features CLONE qrexec 1 && qvm-run --service --pass-io --no-gui CLONE qubes.PostInstall && qvm-shutdown CLONE
1 parent 641fbb7 commit 2965dd1

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

doc/manpages/qvm-template.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Commands
8585
install
8686
^^^^^^^
8787

88-
| :command:`qvm-template install` [-h] [--pool *POOL*] [--nogpgcheck] [--allow-pv] [--downloaddir *DOWNLOADDIR*] [--retries *RETRIES*] [*TEMPLATESPEC* [*TEMPLATESPEC* ...]]
88+
| :command:`qvm-template install` [-h] [--pool *POOL*] [--nogpgcheck] [--allow-pv] [--skip-start] [--downloaddir *DOWNLOADDIR*] [--retries *RETRIES*] [*TEMPLATESPEC* [*TEMPLATESPEC* ...]]
8989
9090
Install template packages.
9191
See Section `Template Spec`_ for an explanation of *TEMPLATESPEC*.
@@ -106,6 +106,10 @@ See Section `Template Spec`_ for an explanation of *TEMPLATESPEC*.
106106

107107
Allow templates that set virt_mode to pv.
108108

109+
.. option:: --skip-start
110+
111+
Do not start templates to call their qubes.PostInstall service.
112+
109113
.. option:: --downloaddir DOWNLOADDIR
110114

111115
Specify download directory. (default: .)
@@ -117,7 +121,7 @@ See Section `Template Spec`_ for an explanation of *TEMPLATESPEC*.
117121
{reinstall,downgrade,upgrade}
118122
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
119123

120-
| :command:`qvm-template {reinstall,downgrade,upgrade}` [-h] [--nogpgcheck] [--allow-pv] [--downloaddir *DOWNLOADDIR*] [--retries *RETRIES*] [*TEMPLATESPEC* [*TEMPLATESPEC* ...]]
124+
| :command:`qvm-template {reinstall,downgrade,upgrade}` [-h] [--nogpgcheck] [--allow-pv] [--skip-start] [--downloaddir *DOWNLOADDIR*] [--retries *RETRIES*] [*TEMPLATESPEC* [*TEMPLATESPEC* ...]]
121125
122126
Reinstall/downgrade/upgrade template packages.
123127

@@ -135,6 +139,10 @@ See Section `Template Spec`_ for an explanation of *TEMPLATESPEC*.
135139

136140
Allow templates that set virt_mode to pv.
137141

142+
.. option:: --skip-start
143+
144+
Do not start templates to call their qubes.PostInstall service.
145+
138146
.. option:: --downloaddir DOWNLOADDIR
139147

140148
Specify download directory. (default: .)

qubesadmin/tests/tools/qvm_template.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ def test_100_install_local_success(
451451
releasever='4.1',
452452
yes=False,
453453
allow_pv=False,
454+
skip_start=False,
454455
pool=None
455456
)
456457
mock_tmpdir.return_value.__enter__.return_value = \
@@ -565,6 +566,7 @@ def test_101_install_local_postprocargs_success(
565566
releasever='4.1',
566567
yes=False,
567568
allow_pv=True,
569+
skip_start=False,
568570
pool='my-pool'
569571
)
570572
mock_tmpdir.return_value.__enter__.return_value = \
@@ -643,6 +645,7 @@ def test_102_install_local_badsig_fail(
643645
releasever='4.1',
644646
yes=False,
645647
allow_pv=False,
648+
skip_start=False,
646649
pool=None
647650
)
648651
mock_tmpdir.return_value.__enter__.return_value = \
@@ -710,6 +713,7 @@ def test_103_install_local_exists_fail(
710713
releasever='4.1',
711714
yes=False,
712715
allow_pv=False,
716+
skip_start=False,
713717
pool=None
714718
)
715719
mock_tmpdir.return_value.__enter__.return_value = \
@@ -781,6 +785,7 @@ def test_104_install_local_badpkgname_fail(
781785
releasever='4.1',
782786
yes=False,
783787
allow_pv=False,
788+
skip_start=False,
784789
pool=None
785790
)
786791
mock_tmpdir.return_value.__enter__.return_value = \
@@ -832,6 +837,7 @@ def test_106_install_local_badpath_fail(
832837
releasever='4.1',
833838
yes=False,
834839
allow_pv=False,
840+
skip_start=False,
835841
pool=None
836842
)
837843
mock_tmpdir.return_value.__enter__.return_value = \
@@ -927,6 +933,7 @@ def test_107_install_download_success(
927933
yes=False,
928934
keep_cache=False,
929935
allow_pv=False,
936+
skip_start=False,
930937
pool=None
931938
)
932939
mock_tmpdir.return_value.__enter__.return_value = \
@@ -1028,6 +1035,7 @@ def test_108_install_download_fail_exists(
10281035
yes=False,
10291036
keep_cache=True,
10301037
allow_pv=False,
1038+
skip_start=False,
10311039
pool=None
10321040
)
10331041
mock_tmpdir.return_value.__enter__.return_value = \
@@ -1108,6 +1116,7 @@ def test_109_install_fail_extract(
11081116
releasever='4.1',
11091117
yes=False,
11101118
allow_pv=False,
1119+
skip_start=False,
11111120
pool=None
11121121
)
11131122
mock_tmpdir.return_value.__enter__.return_value = \
@@ -4298,6 +4307,7 @@ def test_200_reinstall_success(
42984307
yes=False,
42994308
keep_cache=True,
43004309
allow_pv=False,
4310+
skip_start=False,
43014311
pool=None
43024312
)
43034313
mock_tmpdir.return_value.__enter__.return_value = \
@@ -4404,6 +4414,7 @@ def test_201_reinstall_fail_noversion(
44044414
yes=False,
44054415
keep_cache=True,
44064416
allow_pv=False,
4417+
skip_start=False,
44074418
pool=None
44084419
)
44094420
qubesadmin.tools.qvm_template.install(args, self.app,
@@ -4515,6 +4526,7 @@ def test_202_reinstall_local_success(
45154526
releasever='4.1',
45164527
yes=False,
45174528
allow_pv=False,
4529+
skip_start=False,
45184530
pool=None
45194531
)
45204532
mock_tmpdir.return_value.__enter__.return_value = \
@@ -4923,6 +4935,7 @@ def test_220_downgrade_skip_lower(
49234935
yes=False,
49244936
keep_cache=True,
49254937
allow_pv=False,
4938+
skip_start=False,
49264939
pool=None
49274940
)
49284941
qubesadmin.tools.qvm_template.install(args, self.app,
@@ -5009,6 +5022,7 @@ def test_221_upgrade_skip_higher(
50095022
yes=False,
50105023
keep_cache=True,
50115024
allow_pv=False,
5025+
skip_start=False,
50125026
pool=None
50135027
)
50145028
qubesadmin.tools.qvm_template.install(args, self.app,

qubesadmin/tools/qvm_template.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ def parser_add_command(cmd, help_str):
180180
parser_downgrade, parser_upgrade]:
181181
parser_x.add_argument('--allow-pv', action='store_true',
182182
help='Allow templates that set virt_mode to pv.')
183+
parser_x.add_argument('--skip-start', action='store_true',
184+
help='Do not start templates to call their '
185+
'qubes.PostInstall service.')
183186
parser_x.add_argument('templates', nargs='*', metavar='TEMPLATESPEC')
184187

185188
# qvm-template download
@@ -1188,6 +1191,8 @@ def verify(rpmfile, reponame, package_hdr=None):
11881191
]
11891192
if args.allow_pv:
11901193
cmdline.append('--allow-pv')
1194+
if args.skip_start:
1195+
cmdline.append('--skip-start')
11911196
if not override_existing and args.pool:
11921197
cmdline += ['--pool', args.pool]
11931198
subprocess.check_call(cmdline + [

0 commit comments

Comments
 (0)