This commit is contained in:
Kload 2013-11-22 18:00:20 +01:00
parent ae378201c2
commit a575d2d80c
2 changed files with 6 additions and 3 deletions

View file

@ -302,7 +302,7 @@ app:
### app_remove() TODO: Write help ### app_remove() TODO: Write help
remove: remove:
action_help: Remove app action_help: Remove app
api: DELETE /app api: DELETE /app/{app}
arguments: arguments:
app: app:
help: App(s) to delete help: App(s) to delete
@ -310,7 +310,7 @@ app:
### app_upgrade() ### app_upgrade()
upgrade: upgrade:
action_help: Upgrade app action_help: Upgrade app
api: PUT /app api: PUT /app/{app}
arguments: arguments:
app: app:
help: App(s) to upgrade (default all) help: App(s) to upgrade (default all)

View file

@ -41,7 +41,7 @@ from yunohost_hook import hook_exec
repo_path = '/var/cache/yunohost/repo' repo_path = '/var/cache/yunohost/repo'
apps_path = '/usr/share/yunohost/apps' apps_path = '/usr/share/yunohost/apps'
apps_setting_path= '/etc/yunohost/apps/' apps_setting_path= '/etc/yunohost/apps/'
install_tmp = '/var/cache/yunohost/install' install_tmp = '/var/cache/yunohost'
app_tmp_folder = install_tmp + '/from_file' app_tmp_folder = install_tmp + '/from_file'
def app_listlists(): def app_listlists():
@ -313,6 +313,7 @@ def app_upgrade(app, url=None, file=None):
sources.write(re.sub(r''+ original_app_id +'', app_id, line)) sources.write(re.sub(r''+ original_app_id +'', app_id, line))
# Execute App upgrade script # Execute App upgrade script
os.system('chown -hR admin: '+ install_tmp)
if hook_exec(app_tmp_folder +'/scripts/upgrade') != 0: if hook_exec(app_tmp_folder +'/scripts/upgrade') != 0:
#TODO: display fail messages from script #TODO: display fail messages from script
pass pass
@ -409,6 +410,7 @@ def app_install(app, label=None, args=None):
args_dict = {} args_dict = {}
# Execute App install script # Execute App install script
os.system('chown -hR admin: '+ install_tmp)
if hook_exec(app_tmp_folder + '/scripts/install', args_dict) == 0: if hook_exec(app_tmp_folder + '/scripts/install', args_dict) == 0:
# Move scripts and manifest to the right place # Move scripts and manifest to the right place
os.system('mv "'+ app_tmp_folder +'/manifest.json" "'+ app_tmp_folder +'/scripts" '+ app_setting_path) os.system('mv "'+ app_tmp_folder +'/manifest.json" "'+ app_tmp_folder +'/scripts" '+ app_setting_path)
@ -440,6 +442,7 @@ def app_remove(app):
os.system('chmod -R 777 '+ app_setting_path) os.system('chmod -R 777 '+ app_setting_path)
#TODO: display fail messages from script #TODO: display fail messages from script
os.system('chown -hR admin: '+ app_setting_path)
if hook_exec(app_setting_path + '/scripts/remove') != 0: if hook_exec(app_setting_path + '/scripts/remove') != 0:
os.system('chmod -R 700 '+ app_setting_path) os.system('chmod -R 700 '+ app_setting_path)