Postinstall bugfix

This commit is contained in:
Kload 2013-11-21 11:56:28 +01:00
parent 8f12b330b0
commit 3fb93e9e69

View file

@ -193,6 +193,13 @@ def favicon(request):
return '' return ''
def is_installed(request): def is_installed(request):
global installed
try:
with open('/etc/yunohost/installed'):
installed = True
except IOError:
installed = False
request.setHeader('Access-Control-Allow-Origin', '*') # Allow cross-domain requests request.setHeader('Access-Control-Allow-Origin', '*') # Allow cross-domain requests
request.setResponseCode(200, 'OK') request.setResponseCode(200, 'OK')
return json.dumps({ 'installed': installed }) return json.dumps({ 'installed': installed })
@ -216,6 +223,12 @@ def main():
action_map = yaml.load(f) action_map = yaml.load(f)
# Register only postinstall action if YunoHost isn't completely set up # Register only postinstall action if YunoHost isn't completely set up
try:
with open('/etc/yunohost/installed'):
installed = True
except IOError:
installed = False
del action_map['general_arguments'] del action_map['general_arguments']
for category, category_params in action_map.items(): for category, category_params in action_map.items():
api.register('ALL', '/api/'+ category, api_doc) api.register('ALL', '/api/'+ category, api_doc)