Update install.py

This commit is contained in:
2025-10-17 20:25:46 +00:00
parent 26bd352ee2
commit 377585e98e

View File

@@ -14,6 +14,24 @@ is_windows = os_type == "windows"
is_debian = is_linux and os.system('apt --version > /dev/null 2>&1') >> 8 == 0 is_debian = is_linux and os.system('apt --version > /dev/null 2>&1') >> 8 == 0
is_rhel = is_linux and os.system('dnf --version > /dev/null 2>&1') >> 8 == 0 is_rhel = is_linux and os.system('dnf --version > /dev/null 2>&1') >> 8 == 0
def update_system():
if is_debian:
os.system('sudo apt-get update && sudo apt-get upgrade -y')
elif is_rhel:
os.system('sudo dnf upgrade -y')
else
print(f"Update not supported for: {os_type}")
exit(1)
def install(package):
if is_debian:
os.system(f'sudo apt-get install {p} -y')
elif is_rhel:
os.system(f'sudo dnf install {p} -y')
else
print(f"Install not supported for: {os_type}")
exit(1)
def check_os(): def check_os():
if is_linux or is_macos or is_windows: if is_linux or is_macos or is_windows:
print(f"Running on {os_type}") print(f"Running on {os_type}")
@@ -22,14 +40,8 @@ def check_os():
exit(1) exit(1)
if __name__ == "__main__": if __name__ == "__main__":
print(f'is_windows: {is_windows}, is_macos: {is_macos}, is_linux: {is_linux}, is_debian: {is_debian}, is_rhel: {is_rhel}')
check_os() check_os()
if is_debian: update_system()
os.system('sudo apt-get update && sudo apt-get upgrade -y') if is_linux:
for p in linux_packages: for p in linux_packages: install(p)
os.system(f'sudo apt-get install {p} -y')
if is_rhel:
os.system('sudo dnf upgrade -y')
for p in linux_packages:
os.system(f'sudo dnf install {p} -y')
print(f'is_windows: {is_windows}, is_macos: {is_macos}, is_linux: {is_linux}, is_debian: {is_debian}, is_rhel: {is_rhel}')