From 529ba08aee27c31912ed5a4e392e4a4b2d02fdd4 Mon Sep 17 00:00:00 2001 From: midoks Date: Fri, 12 Aug 2022 17:19:09 +0800 Subject: [PATCH] Update system_api.py --- class/core/system_api.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/class/core/system_api.py b/class/core/system_api.py index a64ec0a98..be1c6a67b 100755 --- a/class/core/system_api.py +++ b/class/core/system_api.py @@ -685,19 +685,26 @@ class system_api: newUrl = "https://github.com/midoks/mdserver-web/archive/refs/tags/" + version + ".zip" - r = mw.execShell('wget -O ' + toPath + '/mw.zip ' + newUrl) + dist_mw = toPath + '/mw.zip' + if not os.path.exists(dist_mw): + mw.execShell('wget -O ' + dist_mw + ' ' + newUrl) - mw.execShell('unzip -o ' + toPath + - '/mw.zip' + ' -d ' + toPath) + dist_to = toPath + "/mdserver-web-" + version + if not os.path.exists(dist_to): + mw.execShell('unzip -o ' + toPath + + '/mw.zip' + ' -d ' + toPath) cmd_cp = "cp -rf " + toPath + '/mdserver-web-' + \ version + "/* " + mw.getRootDir() + "/mdserver-web" - mw.execShell(cmd_cp) + rcp = mw.execShell(cmd_cp) + print(rcp) + return mw.returnJson(True, "debug") + mw.execShell('rm -rf ' + toPath + '/mdserver-web-' + version) mw.execShell('rm -rf ' + toPath + '/mw.zip') - self.restartMw() + # self.restartMw() return mw.returnJson(True, '安装更新成功,需自己重启!') return mw.returnJson(False, '已经是最新,无需更新!')