install update before restart
This commit is contained in:
parent
1efe02c87c
commit
e654d391fd
1 changed files with 6 additions and 10 deletions
|
@ -81,6 +81,7 @@ def get_latest_release():
|
||||||
release_data = get(settings.server.get('release_url'))
|
release_data = get(settings.server.get('release_url'))
|
||||||
release = json.loads(release_data.decode('utf-8'))
|
release = json.loads(release_data.decode('utf-8'))
|
||||||
if verify(release):
|
if verify(release):
|
||||||
|
ox.makedirs(settings.updates_path)
|
||||||
with open(os.path.join(settings.updates_path, 'release.json'), 'wb') as fd:
|
with open(os.path.join(settings.updates_path, 'release.json'), 'wb') as fd:
|
||||||
fd.write(release_data)
|
fd.write(release_data)
|
||||||
return release
|
return release
|
||||||
|
@ -111,7 +112,7 @@ def download():
|
||||||
return True
|
return True
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def install():
|
def install(stop=True):
|
||||||
if not os.path.exists(os.path.join(settings.updates_path, 'release.json')):
|
if not os.path.exists(os.path.join(settings.updates_path, 'release.json')):
|
||||||
return True
|
return True
|
||||||
if not os.path.exists(os.path.join(settings.config_path, 'release.json')):
|
if not os.path.exists(os.path.join(settings.config_path, 'release.json')):
|
||||||
|
@ -145,11 +146,9 @@ def install():
|
||||||
os.unlink(module_tar)
|
os.unlink(module_tar)
|
||||||
return False
|
return False
|
||||||
shutil.copy(os.path.join(settings.updates_path, 'release.json'), os.path.join(settings.config_path, 'release.json'))
|
shutil.copy(os.path.join(settings.updates_path, 'release.json'), os.path.join(settings.config_path, 'release.json'))
|
||||||
for cmd in [
|
if stop:
|
||||||
['./ctl', 'stop'],
|
subprocess.call(['./ctl', 'stop'])
|
||||||
['./ctl', 'postupdate', '-o', old_version, '-n', new_version]
|
subprocess.call(['./ctl', 'postupdate', '-o', old_version, '-n', new_version])
|
||||||
]:
|
|
||||||
subprocess.call(cmd)
|
|
||||||
upgrade_app()
|
upgrade_app()
|
||||||
return True
|
return True
|
||||||
return True
|
return True
|
||||||
|
@ -262,11 +261,8 @@ class Update(Thread):
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
self.status('Downloading new version...')
|
self.status('Downloading new version...')
|
||||||
self.status('Installing new version...')
|
self.status('Installing new version...')
|
||||||
# install right now calls stop!
|
if not install(False):
|
||||||
'''
|
|
||||||
if not install():
|
|
||||||
self.status('Installation failed...')
|
self.status('Installation failed...')
|
||||||
'''
|
|
||||||
restart_oml()
|
restart_oml()
|
||||||
|
|
||||||
def update_database(self):
|
def update_database(self):
|
||||||
|
|
Loading…
Reference in a new issue