From 591374d6d1b1f3fa7d80d40fa48808b00efc19da Mon Sep 17 00:00:00 2001 From: j Date: Sun, 31 Jan 2016 18:54:37 +0530 Subject: [PATCH] no postupdate for new versions, dont stop daemon in install --- oml/update.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/oml/update.py b/oml/update.py index d42cd6f..3e5611e 100644 --- a/oml/update.py +++ b/oml/update.py @@ -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