From 44fc8a51ad45cbb1d3b2ebf28db2c69702392de3 Mon Sep 17 00:00:00 2001 From: ThomasVon2021 <1767893964@qq.com> Date: Mon, 28 Oct 2024 19:54:40 +0800 Subject: [PATCH] chore:update to v1.4.9 --- package/kvmd-web/install-kvmd-web.sh | 8 +++----- script/install_release.py | 21 +++++++++++++++++++++ script/package.json | 2 +- web_src/config/user.json | 1 - web_src/web_server | 2 +- 5 files changed, 26 insertions(+), 8 deletions(-) delete mode 100644 web_src/config/user.json diff --git a/package/kvmd-web/install-kvmd-web.sh b/package/kvmd-web/install-kvmd-web.sh index eaa6518..156f19b 100755 --- a/package/kvmd-web/install-kvmd-web.sh +++ b/package/kvmd-web/install-kvmd-web.sh @@ -13,11 +13,9 @@ if [ -n "${pid}" ]; then kill -9 "${pid}" fi -if [ -f "/mnt/exec/release/config/user.json" ]; then - rsync -av --exclude 'config/user.json' release /mnt/exec/ -else - cp -R release /mnt/exec -fi + +cp -R release /mnt/exec + chmod 777 -R /mnt/exec/release diff --git a/script/install_release.py b/script/install_release.py index 47637fb..dbaf905 100755 --- a/script/install_release.py +++ b/script/install_release.py @@ -113,6 +113,17 @@ def merge_config(existing_config, new_config): print(f"The configuration file has been successfully merged and saved to {new_config_path}") +def compare_versions(version1, version2): + # Remove 'v' if it exists + if version1.startswith('v'): + version1 = version1[1:] + if version2.startswith('v'): + version2 = version2[1:] + + v1 = list(map(int, version1.split('.'))) + v2 = list(map(int, version2.split('.'))) + return v1 >= v2 + def main(): print("start install") global gArgs @@ -153,6 +164,16 @@ def main(): subprocess.check_output(cmd, shell = True, cwd=gArgs.releasepath ) print('restart kvmd-web successful') merge_and_save_config('/tmp/config/app.json', '/mnt/exec/release/config/app.json') + # Check if the local file exists + if os.path.exists('/tmp/config/package.json'): + # Read the local configuration file + with open('/tmp/config/package.json', 'r', encoding='utf-8') as f: + local_config = json.load(f) + if 'version' in local_config: + version = local_config['version'] + if compare_versions(version, '1.4.9'): + merge_and_save_config('/tmp/config/package.json', '/mnt/exec/release/config/package.json') + else: print(gArgs.releasepath, ' not exit') diff --git a/script/package.json b/script/package.json index 2de6378..d5b2e32 100755 --- a/script/package.json +++ b/script/package.json @@ -1,5 +1,5 @@ { - "version": "v1.4.8", + "version": "v1.4.9", "md5value": "", "oled":{ "oled_enable": 1, diff --git a/web_src/config/user.json b/web_src/config/user.json deleted file mode 100644 index 75cf32e..0000000 --- a/web_src/config/user.json +++ /dev/null @@ -1 +0,0 @@ -{"user":"admin","pwd":"admin","id":"1208487a-e48f-49e3-8f7c-693c134c1a47"} \ No newline at end of file diff --git a/web_src/web_server b/web_src/web_server index 0519fc5..bb7ad34 160000 --- a/web_src/web_server +++ b/web_src/web_server @@ -1 +1 @@ -Subproject commit 0519fc5987f028efbaa16059b1ee6574a8b682a7 +Subproject commit bb7ad34130be1cfd2cc0c38242160b657301041a