usmannasir
2025-08-14 20:50:05 +05:00
parent 94bd6f7b5d
commit e6541df356
2 changed files with 29 additions and 5 deletions

3
.idea/workspace.xml generated
View File

@@ -6,6 +6,7 @@
<component name="ChangeListManager">
<list default="true" id="5251c5c9-f2a1-41f2-bc76-10b517091df1" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/plogical/installUtilities.py" beforeDir="false" afterPath="$PROJECT_DIR$/plogical/installUtilities.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -117,7 +118,7 @@
<workItem from="1754429757112" duration="3503000" />
<workItem from="1754433799097" duration="517000" />
<workItem from="1754448353513" duration="2970000" />
<workItem from="1754511414251" duration="47027000" />
<workItem from="1754511414251" duration="48713000" />
</task>
<servers />
</component>

View File

@@ -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)