no postupdate for new versions, dont stop daemon in install

This commit is contained in:
j 2016-01-31 18:54:37 +05:30
parent b7d784a0f8
commit 591374d6d1

View file

@ -19,6 +19,7 @@ import OpenSSL.crypto
import ox
from oxtornado import actions
import state
import settings
import db
@ -144,7 +145,7 @@ def download():
return True
return True
def install(stop=True):
def install():
if not os.path.exists(os.path.join(settings.updates_path, 'release.json')):
return True
if not os.path.exists(os.path.join(settings.data_path, 'release.json')):
@ -181,10 +182,10 @@ def install(stop=True):
os.unlink(module_tar)
return False
shutil.copy(os.path.join(settings.updates_path, 'release.json'), os.path.join(settings.data_path, 'release.json'))
if stop:
subprocess.call(['./ctl', 'stop'])
subprocess.call(['./ctl', 'postupdate', '-o', old_version, '-n', new_version])
upgrade_app()
# FIXME: still needed?
if old_version < '20160112-651-de984a3':
subprocess.call(['./ctl', 'postupdate', '-o', old_version, '-n', new_version])
return True
return True
@ -205,8 +206,12 @@ def update_available():
def restart_oml(update=False):
if update:
get_latest_release()
subprocess.Popen([os.path.join(settings.base_dir, 'ctl'), 'restart'],
close_fds=True, start_new_session=True)
if sys.platform == 'win32':
subprocess.Popen([os.path.join(settings.base_dir, 'ctl.bat'), 'restart'],
start_new_session=True)
else:
subprocess.Popen([os.path.join(settings.base_dir, 'ctl'), 'restart'],
close_fds=True, start_new_session=True)
def get_app_version(app):
plist = app + '/Contents/Info.plist'
@ -302,7 +307,7 @@ class Update(Thread):
time.sleep(5)
self.status('Downloading...')
self.status('Installing...')
if not install(False):
if not install():
self.status('Installation failed.')
return True
return False