From 4dfad5f1aeb2cc46fef07a3f5cd6d4d2b8230e6d Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Fri, 15 Jun 2012 17:37:19 +0200 Subject: [PATCH] dom0: qvm-run --nogui switch Can be used to not start guid. --- dom0/qvm-core/qubes.py | 4 ++-- dom0/qvm-tools/qvm-run | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dom0/qvm-core/qubes.py b/dom0/qvm-core/qubes.py index 08c2b727..f7385009 100755 --- a/dom0/qvm-core/qubes.py +++ b/dom0/qvm-core/qubes.py @@ -1301,7 +1301,7 @@ class QubesVm(object): return conf - def run(self, command, verbose = True, autostart = False, notify_function = None, passio = False, passio_popen = False, localcmd = None, wait = False): + def run(self, command, verbose = True, autostart = False, notify_function = None, passio = False, passio_popen = False, localcmd = None, wait = False, gui = True): """command should be in form 'user:cmdline'""" if not self.is_running(): @@ -1321,7 +1321,7 @@ class QubesVm(object): raise QubesException("Not enough memory to start '{0}' VM! Close one or more running VMs and try again.".format(self.name)) xid = self.get_xid() - if os.getenv("DISPLAY") is not None and not self.is_guid_running(): + if gui and os.getenv("DISPLAY") is not None and not self.is_guid_running(): self.start_guid(verbose = verbose, notify_function = notify_function) args = [qrexec_client_path, "-d", str(xid), command] diff --git a/dom0/qvm-tools/qvm-run b/dom0/qvm-tools/qvm-run index 89d53756..d83236cd 100755 --- a/dom0/qvm-tools/qvm-run +++ b/dom0/qvm-tools/qvm-run @@ -85,7 +85,7 @@ def vm_run_cmd(vm, cmd, options): return vm.run(cmd, autostart = options.auto, verbose = options.verbose, notify_function = tray_notify_generic if options.tray else None, - passio = options.passio, localcmd = options.localcmd) + passio = options.passio, localcmd = options.localcmd, gui = options.gui) except QubesException as err: if options.tray: tray_notify_error(str(err)) @@ -130,6 +130,9 @@ def main(): parser.add_option ("--force", action="store_true", dest="force", default=False, help="Force operation, even if may damage other VMs (eg shutdown of NetVM)") + parser.add_option ("--nogui", action="store_false", dest="gui", default=True, + help="Run command without gui") + (options, args) = parser.parse_args ()