Set appmenus_templates_dir also for StandaloneVM (#45)
StandaloneVM also have appmenus templates - retrieved from VM. User can choose some of them to real menu.
This commit is contained in:
parent
df0240c218
commit
4f33e17e69
@ -268,6 +268,9 @@ class QubesVm(object):
|
|||||||
else:
|
else:
|
||||||
assert self.root_img is not None, "Missing root_img for standalone VM!"
|
assert self.root_img is not None, "Missing root_img for standalone VM!"
|
||||||
|
|
||||||
|
if updateable:
|
||||||
|
self.appmenus_templates_dir = self.dir_path + "/" + default_appmenus_templates_subdir
|
||||||
|
|
||||||
# By default allow use all VCPUs
|
# By default allow use all VCPUs
|
||||||
if vcpus is None:
|
if vcpus is None:
|
||||||
qubes_host = QubesHost()
|
qubes_host = QubesHost()
|
||||||
|
@ -27,9 +27,7 @@ import sys
|
|||||||
import fnmatch
|
import fnmatch
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from qubes.qubes import QubesVmCollection,QubesException
|
from qubes.qubes import QubesVmCollection,QubesException
|
||||||
from qubes.qubes import qrexec_client_path,default_appmenus_templates_subdir
|
from qubes.qubes import qrexec_client_path
|
||||||
|
|
||||||
#TODO: qrexec_client_path
|
|
||||||
|
|
||||||
# fields required to be present (and verified) in retrieved desktop file
|
# fields required to be present (and verified) in retrieved desktop file
|
||||||
required_fields = [ "Name", "Exec" ]
|
required_fields = [ "Name", "Exec" ]
|
||||||
@ -156,32 +154,30 @@ def main():
|
|||||||
print "ERROR: No appmenus received, terminating"
|
print "ERROR: No appmenus received, terminating"
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
# Contstruct path to work also for StandaloneVM
|
assert os.path.exists(vm.appmenus_templates_dir)
|
||||||
appmenus_templates = vm.dir_path + '/' + default_appmenus_templates_subdir
|
|
||||||
assert os.path.exists(appmenus_templates)
|
|
||||||
|
|
||||||
# Create new/update existing templates
|
# Create new/update existing templates
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
print "--> Got {0} appmenus, storing to disk".format(str(len(new_appmenus)))
|
print "--> Got {0} appmenus, storing to disk".format(str(len(new_appmenus)))
|
||||||
for appmenu_file in new_appmenus.keys():
|
for appmenu_file in new_appmenus.keys():
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
if os.path.exists(appmenus_templates + '/' + appmenu_file):
|
if os.path.exists(appmenus_templates_dir + '/' + appmenu_file):
|
||||||
print "---> Updating {0}".format(appmenu_file)
|
print "---> Updating {0}".format(appmenu_file)
|
||||||
else:
|
else:
|
||||||
print "---> Creating {0}".format(appmenu_file)
|
print "---> Creating {0}".format(appmenu_file)
|
||||||
create_template(appmenus_templates + '/' + appmenu_file, new_appmenus[appmenu_file])
|
create_template(appmenus_templates_dir + '/' + appmenu_file, new_appmenus[appmenu_file])
|
||||||
|
|
||||||
# Delete appmenus of remove applications
|
# Delete appmenus of remove applications
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
print "--> Cleaning old files"
|
print "--> Cleaning old files"
|
||||||
for appmenu_file in os.listdir(appmenus_templates):
|
for appmenu_file in os.listdir(appmenus_templates_dir):
|
||||||
if not fnmatch.fnmatch(appmenu_file, '*.desktop'):
|
if not fnmatch.fnmatch(appmenu_file, '*.desktop'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not new_appmenus.has_key(appmenu_file):
|
if not new_appmenus.has_key(appmenu_file):
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
print "---> Removing {0}".format(appmenu_file)
|
print "---> Removing {0}".format(appmenu_file)
|
||||||
os.unlink(appmenus_templates + '/' + appmenu_file)
|
os.unlink(appmenus_templates_dir + '/' + appmenu_file)
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user