From a2456dd73b7d331afccabb88e44dcb43705a1241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 23 Nov 2015 02:34:53 +0100 Subject: [PATCH] firstboot: restore appmenus retrieval code This part isn't (and probably shouldn't be) handled by salt. QubesOS/qubes-issues#1258 --- firstboot/modules/qubes_setup.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/firstboot/modules/qubes_setup.py b/firstboot/modules/qubes_setup.py index fbb516e..93687c3 100644 --- a/firstboot/modules/qubes_setup.py +++ b/firstboot/modules/qubes_setup.py @@ -147,6 +147,15 @@ class moduleClass(Module): errors = [] + # Finish template(s) installation, because it wasn't fully possible + # from anaconda (it isn't possible to start a VM there). + # This is specific to firstboot, not general configuration. + for template in os.listdir('/var/lib/qubes/vm-templates'): + try: + self.configure_template(template) + except Exception as e: + errors.append((self.stage, str(e))) + self.configure_default_template() self.configure_qubes() self.configure_network() @@ -212,6 +221,9 @@ class moduleClass(Module): def run_command_in_thread(self, *args): self.run_in_thread(self.run_command, args) + def configure_template(self, name): + self.show_stage(_("Configuring TemplateVM {}".format(name))) + self.run_in_thread(self.do_configure_template, args=(name,)) def configure_qubes(self): self.show_stage('Executing qubes configuration') @@ -276,6 +288,12 @@ class moduleClass(Module): self.run_command(['/usr/sbin/service', 'qubes-netvm', 'start']) + def do_configure_template(self, template): + self.run_command(['qvm-start', '--no-guid', template]) + self.run_command(['su', '-c', + 'qvm-sync-appmenus {}'.format(template), + '-', self.qubes_user]) + self.run_command(['qvm-shutdown', '--wait', template]) def createScreen(self): self.vbox = gtk.VBox(spacing=5)