debian 12

This commit is contained in:
usmannasir
2025-09-18 01:58:24 +05:00
parent 0e45e6272c
commit 09b50511cc
3 changed files with 29 additions and 6 deletions

View File

@@ -34,6 +34,7 @@ centos = install_utils.centos
ubuntu = install_utils.ubuntu
cent8 = install_utils.cent8
openeuler = install_utils.openeuler
debian12 = install_utils.debian12
cent9 = 4 # Not in install_utils yet
CloudLinux8 = 0 # Not in install_utils yet
@@ -73,6 +74,10 @@ class preFlightsChecks:
"""Check if distro is CentOS, CentOS 8, or OpenEuler"""
return self.distro in [centos, cent8, openeuler]
def is_debian_family(self):
"""Check if distro is Ubuntu or Debian 12"""
return self.distro in [ubuntu, debian12]
def manage_service(self, service_name, action="start"):
"""Unified service management"""
command = f'systemctl {action} {service_name}'
@@ -469,6 +474,15 @@ class preFlightsChecks:
logging.InstallLog.writeToFile("[ERROR] Exception during CyberPanel install")
preFlightsChecks.stdOut("[ERROR] Exception during CyberPanel install")
os._exit(os.EX_SOFTWARE)
elif self.distro == debian12:
try:
# Use the official LiteSpeed repository setup method for Debian 12
command = "bash -c 'wget -O - https://repo.litespeed.sh | bash'"
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
except:
logging.InstallLog.writeToFile("[ERROR] Exception during CyberPanel install - Debian 12 repository setup")
preFlightsChecks.stdOut("[ERROR] Exception during CyberPanel install - Debian 12 repository setup")
os._exit(os.EX_SOFTWARE)
elif self.distro == centos:
command = 'rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.2-1.el7.noarch.rpm'

View File

@@ -17,6 +17,7 @@ centos = install_utils.centos
ubuntu = install_utils.ubuntu
cent8 = install_utils.cent8
openeuler = install_utils.openeuler
debian12 = install_utils.debian12
def get_Ubuntu_release():

View File

@@ -269,13 +269,14 @@ ubuntu = 0
centos = 1
cent8 = 2
openeuler = 3
debian12 = 4
def get_distro():
"""
Detect Linux distribution
Returns: Distribution constant (ubuntu, centos, cent8, or openeuler)
Returns: Distribution constant (ubuntu, centos, cent8, openeuler, or debian12)
"""
distro = -1
distro_file = ""
@@ -291,9 +292,16 @@ def get_distro():
distro = ubuntu
break
else:
# Pure Debian system
distro = ubuntu # Treat Debian same as Ubuntu for package management
# Pure Debian system - check version
distro_file = "/etc/debian_version"
with open(distro_file) as f:
debian_version = f.read().strip()
# Check specific Debian versions
if debian_version.startswith('bookworm') or '12' in debian_version:
distro = debian12
else:
# For other Debian versions, treat same as Ubuntu for compatibility
distro = ubuntu
elif exists("/etc/lsb-release"):
distro_file = "/etc/lsb-release"
@@ -379,7 +387,7 @@ def get_package_install_command(distro, package_name, options=""):
Returns:
tuple: (command, shell) where shell indicates if shell=True is needed
"""
if distro == ubuntu:
if distro == ubuntu or distro == debian12:
# Map packages for Debian compatibility
package_name = map_debian_packages(package_name)
command = f"DEBIAN_FRONTEND=noninteractive apt-get -y install {package_name} {options}"
@@ -405,7 +413,7 @@ def get_package_remove_command(distro, package_name):
Returns:
tuple: (command, shell) where shell indicates if shell=True is needed
"""
if distro == ubuntu:
if distro == ubuntu or distro == debian12:
command = f"DEBIAN_FRONTEND=noninteractive apt-get -y remove {package_name}"
shell = True
elif distro == centos:
@@ -429,7 +437,7 @@ def resFailed(distro, res):
Returns:
bool: True if failed, False if successful
"""
if distro == ubuntu and res != 0:
if (distro == ubuntu or distro == debian12) and res != 0:
return True
elif distro == centos and res != 0:
return True