mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-12-24 09:19:43 +01:00
debian 12
This commit is contained in:
@@ -34,6 +34,7 @@ centos = install_utils.centos
|
|||||||
ubuntu = install_utils.ubuntu
|
ubuntu = install_utils.ubuntu
|
||||||
cent8 = install_utils.cent8
|
cent8 = install_utils.cent8
|
||||||
openeuler = install_utils.openeuler
|
openeuler = install_utils.openeuler
|
||||||
|
debian12 = install_utils.debian12
|
||||||
cent9 = 4 # Not in install_utils yet
|
cent9 = 4 # Not in install_utils yet
|
||||||
CloudLinux8 = 0 # Not in install_utils yet
|
CloudLinux8 = 0 # Not in install_utils yet
|
||||||
|
|
||||||
@@ -72,6 +73,10 @@ class preFlightsChecks:
|
|||||||
def is_centos_family(self):
|
def is_centos_family(self):
|
||||||
"""Check if distro is CentOS, CentOS 8, or OpenEuler"""
|
"""Check if distro is CentOS, CentOS 8, or OpenEuler"""
|
||||||
return self.distro in [centos, cent8, 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"):
|
def manage_service(self, service_name, action="start"):
|
||||||
"""Unified service management"""
|
"""Unified service management"""
|
||||||
@@ -469,6 +474,15 @@ class preFlightsChecks:
|
|||||||
logging.InstallLog.writeToFile("[ERROR] Exception during CyberPanel install")
|
logging.InstallLog.writeToFile("[ERROR] Exception during CyberPanel install")
|
||||||
preFlightsChecks.stdOut("[ERROR] Exception during CyberPanel install")
|
preFlightsChecks.stdOut("[ERROR] Exception during CyberPanel install")
|
||||||
os._exit(os.EX_SOFTWARE)
|
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:
|
elif self.distro == centos:
|
||||||
command = 'rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.2-1.el7.noarch.rpm'
|
command = 'rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.2-1.el7.noarch.rpm'
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ centos = install_utils.centos
|
|||||||
ubuntu = install_utils.ubuntu
|
ubuntu = install_utils.ubuntu
|
||||||
cent8 = install_utils.cent8
|
cent8 = install_utils.cent8
|
||||||
openeuler = install_utils.openeuler
|
openeuler = install_utils.openeuler
|
||||||
|
debian12 = install_utils.debian12
|
||||||
|
|
||||||
|
|
||||||
def get_Ubuntu_release():
|
def get_Ubuntu_release():
|
||||||
|
|||||||
@@ -269,13 +269,14 @@ ubuntu = 0
|
|||||||
centos = 1
|
centos = 1
|
||||||
cent8 = 2
|
cent8 = 2
|
||||||
openeuler = 3
|
openeuler = 3
|
||||||
|
debian12 = 4
|
||||||
|
|
||||||
|
|
||||||
def get_distro():
|
def get_distro():
|
||||||
"""
|
"""
|
||||||
Detect Linux distribution
|
Detect Linux distribution
|
||||||
|
|
||||||
Returns: Distribution constant (ubuntu, centos, cent8, or openeuler)
|
Returns: Distribution constant (ubuntu, centos, cent8, openeuler, or debian12)
|
||||||
"""
|
"""
|
||||||
distro = -1
|
distro = -1
|
||||||
distro_file = ""
|
distro_file = ""
|
||||||
@@ -291,9 +292,16 @@ def get_distro():
|
|||||||
distro = ubuntu
|
distro = ubuntu
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# Pure Debian system
|
# Pure Debian system - check version
|
||||||
distro = ubuntu # Treat Debian same as Ubuntu for package management
|
|
||||||
distro_file = "/etc/debian_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"):
|
elif exists("/etc/lsb-release"):
|
||||||
distro_file = "/etc/lsb-release"
|
distro_file = "/etc/lsb-release"
|
||||||
@@ -379,7 +387,7 @@ def get_package_install_command(distro, package_name, options=""):
|
|||||||
Returns:
|
Returns:
|
||||||
tuple: (command, shell) where shell indicates if shell=True is needed
|
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
|
# Map packages for Debian compatibility
|
||||||
package_name = map_debian_packages(package_name)
|
package_name = map_debian_packages(package_name)
|
||||||
command = f"DEBIAN_FRONTEND=noninteractive apt-get -y install {package_name} {options}"
|
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:
|
Returns:
|
||||||
tuple: (command, shell) where shell indicates if shell=True is needed
|
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}"
|
command = f"DEBIAN_FRONTEND=noninteractive apt-get -y remove {package_name}"
|
||||||
shell = True
|
shell = True
|
||||||
elif distro == centos:
|
elif distro == centos:
|
||||||
@@ -429,7 +437,7 @@ def resFailed(distro, res):
|
|||||||
Returns:
|
Returns:
|
||||||
bool: True if failed, False if successful
|
bool: True if failed, False if successful
|
||||||
"""
|
"""
|
||||||
if distro == ubuntu and res != 0:
|
if (distro == ubuntu or distro == debian12) and res != 0:
|
||||||
return True
|
return True
|
||||||
elif distro == centos and res != 0:
|
elif distro == centos and res != 0:
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user