Wait for qubes-session initialization before executing GUI application (#208)
This commit is contained in:
parent
0dc4fb929e
commit
4ae804b3ec
@ -57,6 +57,24 @@ def actually_execute(domid, cmd, options):
|
||||
args += ["-e"]
|
||||
subprocess.call(args)
|
||||
|
||||
def start_guid(vm, options):
|
||||
if options.verbose:
|
||||
print "--> Starting Qubes GUId..."
|
||||
xid = vm.get_xid()
|
||||
|
||||
retcode = subprocess.call ([qubes_guid_path, "-d", str(xid), "-c", vm.label.color, "-i", vm.label.icon, "-l", str(vm.label.index)])
|
||||
if (retcode != 0) :
|
||||
print "ERROR: Cannot start qubes_guid!"
|
||||
if options.tray:
|
||||
tray_notify_error ("ERROR: Cannot start qubes_guid!")
|
||||
exit (1)
|
||||
|
||||
if options.verbose:
|
||||
print "--> Waiting for qubes-session..."
|
||||
|
||||
subprocess.call([qrexec_client_path, "-d", str(xid), "user:echo $$ >> /tmp/qubes-session-waiter; [ ! -f /tmp/qubes-session-env ] && exec sleep 365d"])
|
||||
|
||||
|
||||
def vm_run_cmd(vm, cmd, options):
|
||||
if options.shutdown:
|
||||
if options.verbose:
|
||||
@ -103,27 +121,14 @@ def vm_run_cmd(vm, cmd, options):
|
||||
exit (1)
|
||||
|
||||
if os.getenv("DISPLAY") is not None:
|
||||
if options.verbose:
|
||||
print "--> Starting Qubes GUId..."
|
||||
|
||||
retcode = subprocess.call ([qubes_guid_path, "-d", str(xid), "-c", vm.label.color, "-i", vm.label.icon, "-l", str(vm.label.index)])
|
||||
if (retcode != 0) :
|
||||
print "ERROR: Cannot start qubes_guid!"
|
||||
if options.tray:
|
||||
tray_notify_error ("ERROR: Cannot start qubes_guid!")
|
||||
exit (1)
|
||||
start_guid(vm, options)
|
||||
|
||||
actually_execute(str(xid), cmd, options);
|
||||
|
||||
else: # VM already running...
|
||||
xid = vm.get_xid()
|
||||
if os.getenv("DISPLAY") is not None and not os.path.isfile("/var/run/qubes/guid_running.{0}".format(xid)):
|
||||
retcode = subprocess.call ([qubes_guid_path, "-d", str(xid), "-c", vm.label.color, "-i", vm.label.icon, "-l", str(vm.label.index)])
|
||||
if (retcode != 0) :
|
||||
print "ERROR: Cannot start qubes_guid!"
|
||||
if options.tray:
|
||||
tray_notify_error ("ERROR: Cannot start the GUI daemon for this VM!")
|
||||
exit (1)
|
||||
start_guid(vm, options)
|
||||
actually_execute(str(xid), cmd, options);
|
||||
|
||||
def main():
|
||||
|
Loading…
Reference in New Issue
Block a user