Skip to content

Commit

Permalink
chore:update to v1.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasVon2021 committed Dec 31, 2024
1 parent 18f081a commit 3a7b10d
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[submodule "web_src/web_server"]
path = web_src/web_server
url = https://github.com/ThomasVon2021/blikvm-web-server.git
branch = master
[submodule "web_src/web_client"]
path = web_src/web_client
url = https://github.com/ThomasVon2021/blikvm-web-client.git
branch = master
4 changes: 2 additions & 2 deletions package/kvmd-web/kvmd-web.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=BLIKVM - web controller daemon
After=network.target busybox-syslogd.service
Requires=network.target busybox-syslogd.service
After=network.target
Requires=network.target

[Service]
Type=simple
Expand Down
54 changes: 52 additions & 2 deletions script/install_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,48 @@ def compare_versions(version1, version2):
v2 = list(map(int, version2.split('.')))
return v1 >= v2

def disable_service_if_exists(services):
"""
Disables the given systemd services if they exist.
:param services: A list of service names to check and disable.
"""
for service in services:
try:
# Check if the service exists
result = subprocess.run(
['systemctl', 'status', service],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL
)
# If the service exists (exit code 0), disable it
if result.returncode == 0:
subprocess.run(['systemctl', 'disable', service], check=True)
print(f"Service '{service}' disabled successfully.")
else:
print(f"Service '{service}' does not exist or is inactive, skipping.")
except subprocess.CalledProcessError:
# Handle case where the service does not exist or can't be disabled
print(f"Service '{service}' could not be disabled (likely does not exist).")
except Exception as e:
# Catch any unexpected errors
print(f"Unexpected error with service '{service}': {e}")

def create_directory_if_not_exists(path):
"""
Checks if the directory exists, and if not, creates it.
:param path: The directory path to check and create.
"""
if not os.path.exists(path):
try:
os.makedirs(path)
print(f"Directory '{path}' created successfully.")
except OSError as e:
print(f"Error creating directory '{path}': {e}")
else:
print(f"Directory '{path}' already exists.")

def main():
print("start install")
global gArgs
Expand All @@ -150,6 +192,14 @@ def main():
execute_cmd(cmd,sh_path)
print('kill janus done')

services_to_disable = [
'kvmd-janus',
'kvmd-hid',
'kvmd-main',
'kvmd-video'
]
disable_service_if_exists(services_to_disable)

# install all software
if os.path.exists(gArgs.releasepath):
source_dir = '/mnt/exec/release/config'
Expand All @@ -160,8 +210,8 @@ def main():
if os.path.exists(source_package) :
cmd = "cp /usr/bin/blikvm/package.json /tmp/config"
subprocess.check_output(cmd, shell = True, cwd=gArgs.releasepath )
cmd = "systemctl disable kvmd-janus && systemctl disable kvmd-hid && systemctl disable kvmd-main\
&& systemctl disable kvmd-video && bash install-kvmd-web.sh && cp package.json /usr/bin/blikvm/package.json"
create_directory_if_not_exists('/usr/bin/blikvm/')
cmd = "bash install-kvmd-web.sh && cp package.json /usr/bin/blikvm/package.json"
subprocess.check_output(cmd, shell = True, cwd=gArgs.releasepath )
print('install alpha version successful, start to resatrt service, need 60s...')
cmd = "systemctl daemon-reload && systemctl restart kvmd-web"
Expand Down
2 changes: 1 addition & 1 deletion script/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "v1.5.3",
"version": "v1.5.5",
"md5value": ""
}
11 changes: 6 additions & 5 deletions script/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,15 @@ def main():
# get local tag
run_json = '/usr/bin/blikvm/package.json'
if not os.path.exists(run_json):
run_version="v1.0.0"
print("get local version failed ",run_json," is not exit")
with open(run_json,'r',encoding='utf8')as fp_r:
json_data = json.load(fp_r)
run_version = json_data['version']
print("The local version is ",run_version)
else:
with open(run_json,'r',encoding='utf8')as fp_r:
json_data = json.load(fp_r)
run_version = json_data['version']
print("The local version is ",run_version)

# compare version
latest_version_tuple = version_to_tuple("v1.4.0")
run_version_tuple = version_to_tuple(run_version)
if latest_version != run_version:
print("Upgrading ", run_version , " ==> ", latest_version)
Expand Down
2 changes: 1 addition & 1 deletion web_src/web_client

0 comments on commit 3a7b10d

Please sign in to comment.