dom0: qvm-sync-appmenus: support for calling by qrexec_client
This commit is contained in:
parent
a4d1a21b46
commit
4634a6897c
@ -44,12 +44,15 @@ fields_regexp = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def get_appmenus(xid):
|
def get_appmenus(xid):
|
||||||
p = subprocess.Popen ([qrexec_client_path, '-d', str(xid),
|
untrusted_appmenulist = []
|
||||||
'user:grep -H = /usr/share/applications/*.desktop'], stdout=subprocess.PIPE)
|
if xid == -1:
|
||||||
untrusted_appmenulist = p.communicate()[0].split('\n')
|
untrusted_appmenulist = sys.stdin.readlines()
|
||||||
if p.returncode != 0:
|
else:
|
||||||
raise QubesException("Error getting application list")
|
p = subprocess.Popen ([qrexec_client_path, '-d', str(xid),
|
||||||
|
'user:grep -H = /usr/share/applications/*.desktop'], stdout=subprocess.PIPE)
|
||||||
|
untrusted_appmenulist = p.communicate()[0].split('\n')
|
||||||
|
if p.returncode != 0:
|
||||||
|
raise QubesException("Error getting application list")
|
||||||
|
|
||||||
row_no = 0
|
row_no = 0
|
||||||
appmenus = {}
|
appmenus = {}
|
||||||
@ -113,7 +116,7 @@ def create_template(path, values):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
|
env_vmname = os.environ.get("QREXEC_REMOTE_DOMAIN")
|
||||||
usage = "usage: %prog [options] <vm-name>\n"\
|
usage = "usage: %prog [options] <vm-name>\n"\
|
||||||
"Updates desktop file templates for given StandaloneVM or TemplateVM"
|
"Updates desktop file templates for given StandaloneVM or TemplateVM"
|
||||||
|
|
||||||
@ -121,10 +124,13 @@ def main():
|
|||||||
parser.add_option ("-v", "--verbose", action="store_true", dest="verbose", default=False)
|
parser.add_option ("-v", "--verbose", action="store_true", dest="verbose", default=False)
|
||||||
|
|
||||||
(options, args) = parser.parse_args ()
|
(options, args) = parser.parse_args ()
|
||||||
if (len (args) != 1):
|
if (len (args) != 1) and env_vmname is None:
|
||||||
parser.error ("You must specify at least the VM name!")
|
parser.error ("You must specify at least the VM name!")
|
||||||
|
|
||||||
vmname=args[0]
|
if env_vmname:
|
||||||
|
vmname=env_vmname
|
||||||
|
else:
|
||||||
|
vmname=args[0]
|
||||||
|
|
||||||
qvm_collection = QubesVmCollection()
|
qvm_collection = QubesVmCollection()
|
||||||
qvm_collection.lock_db_for_reading()
|
qvm_collection.lock_db_for_reading()
|
||||||
@ -145,11 +151,15 @@ def main():
|
|||||||
print "ERROR: Appmenus can be retrieved only from running VM - start it first"
|
print "ERROR: Appmenus can be retrieved only from running VM - start it first"
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
# Get appmenus from VM
|
new_appmenus = {}
|
||||||
xid = vm.get_xid()
|
if env_vmname is None:
|
||||||
assert xid > 0
|
# Get appmenus from VM
|
||||||
|
xid = vm.get_xid()
|
||||||
|
assert xid > 0
|
||||||
|
|
||||||
new_appmenus = get_appmenus(xid)
|
new_appmenus = get_appmenus(xid)
|
||||||
|
else:
|
||||||
|
new_appmenus = get_appmenus(-1)
|
||||||
|
|
||||||
if len(new_appmenus) == 0:
|
if len(new_appmenus) == 0:
|
||||||
print "ERROR: No appmenus received, terminating"
|
print "ERROR: No appmenus received, terminating"
|
||||||
|
Loading…
Reference in New Issue
Block a user