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 import ox
from oxtornado import actions from oxtornado import actions
import state
import settings import settings
import db import db
@ -144,7 +145,7 @@ def download():
return True return True
return True return True
def install(stop=True): def install():
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.data_path, 'release.json')): 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) os.unlink(module_tar)
return False return False
shutil.copy(os.path.join(settings.updates_path, 'release.json'), os.path.join(settings.data_path, 'release.json')) 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() 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
return True return True
@ -205,8 +206,12 @@ def update_available():
def restart_oml(update=False): def restart_oml(update=False):
if update: if update:
get_latest_release() get_latest_release()
subprocess.Popen([os.path.join(settings.base_dir, 'ctl'), 'restart'], if sys.platform == 'win32':
close_fds=True, start_new_session=True) 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): def get_app_version(app):
plist = app + '/Contents/Info.plist' plist = app + '/Contents/Info.plist'
@ -302,7 +307,7 @@ class Update(Thread):
time.sleep(5) time.sleep(5)
self.status('Downloading...') self.status('Downloading...')
self.status('Installing...') self.status('Installing...')
if not install(False): if not install():
self.status('Installation failed.') self.status('Installation failed.')
return True return True
return False return False