Upgrade bugfix

This commit is contained in:
Kload 2013-12-10 13:03:38 +01:00
parent 7dfec18c3a
commit da0d66a27f

View file

@ -295,6 +295,8 @@ def app_upgrade(app, url=None, file=None):
manifest = _extract_app_from_file(file) manifest = _extract_app_from_file(file)
elif url: elif url:
manifest = _fetch_app_from_git(url) manifest = _fetch_app_from_git(url)
elif 'lastUpdate' not in new_app_dict or 'git' not in new_app_dict:
raise YunoHostError(22, app_id + _(" is a custom app, please provide an URL manually in order to upgrade it"))
elif (new_app_dict['lastUpdate'] > current_app_dict['lastUpdate']) \ elif (new_app_dict['lastUpdate'] > current_app_dict['lastUpdate']) \
or ('update_time' not in current_app_dict['settings'] \ or ('update_time' not in current_app_dict['settings'] \
and (new_app_dict['lastUpdate'] > current_app_dict['settings']['install_time'])) \ and (new_app_dict['lastUpdate'] > current_app_dict['settings']['install_time'])) \
@ -341,7 +343,7 @@ def app_upgrade(app, url=None, file=None):
else: else:
app_setting(app_id, 'update_time', int(time.time())) app_setting(app_id, 'update_time', int(time.time()))
# Move scripts and manifest to the right place # Replace scripts and manifest
os.system('rm -rf "'+ app_setting_path +'/scripts" "'+ app_setting_path +'/manifest.json"') os.system('rm -rf "'+ app_setting_path +'/scripts" "'+ app_setting_path +'/manifest.json"')
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)