From e6541df35669bbbfa39d58db037737e05768707b Mon Sep 17 00:00:00 2001 From: usmannasir Date: Thu, 14 Aug 2025 20:50:05 +0500 Subject: [PATCH] bug fix: https://github.com/usmannasir/cyberpanel/issues/1479#issuecomment-3185937407 --- .idea/workspace.xml | 3 ++- plogical/installUtilities.py | 31 +++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 35c4c2ef6..b7f9292ff 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -6,6 +6,7 @@ + diff --git a/plogical/installUtilities.py b/plogical/installUtilities.py index 20d00fa2f..964c1db9d 100644 --- a/plogical/installUtilities.py +++ b/plogical/installUtilities.py @@ -42,11 +42,34 @@ class installUtilities: @staticmethod def addLiteSpeedRepo(): try: + # Detect OS version to use the correct repository + el_version = "7" # Default to el7 + + # Check for OS version + if os.path.exists('/etc/os-release'): + with open('/etc/os-release', 'r') as f: + content = f.read() + # Check for RHEL/CentOS/AlmaLinux/Rocky 9 + if 'VERSION_ID="9' in content or 'VERSION_ID=9' in content: + el_version = "9" + # Check for RHEL/CentOS/AlmaLinux/Rocky 8 + elif 'VERSION_ID="8' in content or 'VERSION_ID=8' in content: + el_version = "8" + + # Use the appropriate repository URL based on version + repo_urls = { + "7": "http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm", + "8": "http://rpms.litespeedtech.com/centos/litespeed-repo-1.3-1.el8.noarch.rpm", + "9": "http://rpms.litespeedtech.com/centos/litespeed-repo-1.3-1.el9.noarch.rpm" + } + + repo_url = repo_urls.get(el_version, repo_urls["7"]) + cmd = [] - cmd.append("rpm") cmd.append("-ivh") - cmd.append("http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm") + cmd.append(repo_url) + res = subprocess.call(cmd) if res == 1: print("###############################################") @@ -76,7 +99,7 @@ class installUtilities: cmd.append("yum") cmd.append("-y") cmd.append("install") - cmd.append("openlitespeed-1.4.26") + cmd.append("openlitespeed") res = subprocess.call(cmd) @@ -342,7 +365,7 @@ class installUtilities: cmd.append("yum") cmd.append("-y") cmd.append("remove") - cmd.append("openlitespeed-1.4.26") + cmd.append("openlitespeed") res = subprocess.call(cmd)