debian 12

This commit is contained in:
usmannasir
2025-09-18 12:30:22 +05:00
parent b0ef10ba9d
commit 3ae4be91af
3 changed files with 21 additions and 8 deletions

View File

@@ -78,6 +78,13 @@ class preFlightsChecks:
"""Check if distro is Ubuntu or Debian 12"""
return self.distro in [ubuntu, debian12]
def get_service_name(self, service):
"""Get the correct service name for the current distribution"""
service_map = {
'pdns': 'pdns-server' if self.distro == debian12 else 'pdns'
}
return service_map.get(service, service)
def manage_service(self, service_name, action="start"):
"""Unified service management"""
command = f'systemctl {action} {service_name}'
@@ -2456,10 +2463,11 @@ milter_default_action = accept
if state == 'off':
command = 'sudo systemctl stop pdns'
pdns_service = self.get_service_name('pdns')
command = f'sudo systemctl stop {pdns_service}'
subprocess.call(shlex.split(command))
command = 'sudo systemctl disable pdns'
command = f'sudo systemctl disable {pdns_service}'
subprocess.call(shlex.split(command))
try:
@@ -2709,12 +2717,13 @@ vmail
# Start PowerDNS if it was installed
if os.path.exists('/home/cyberpanel/powerdns'):
preFlightsChecks.stdOut("Starting PowerDNS service...")
command = 'systemctl start pdns'
pdns_service = self.get_service_name('pdns')
command = f'systemctl start {pdns_service}'
result = preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if result == 1:
# Check if service started successfully
command = 'systemctl is-active pdns'
command = f'systemctl is-active {pdns_service}'
try:
output = subprocess.check_output(shlex.split(command)).decode("utf-8").strip()
if output == 'active':

View File

@@ -119,7 +119,7 @@ class InstallCyberPanel:
service_map = {
'mariadb': 'mariadb',
'pureftpd': 'pure-ftpd-mysql' if self.distro == ubuntu else 'pure-ftpd',
'pdns': 'pdns'
'pdns': 'pdns-server' if self.distro == debian12 else 'pdns'
}
actual_service = service_map.get(service_name, service_name)

View File

@@ -139,7 +139,9 @@ def get_debian_mariadb_packages():
'python-minimal': '', # Not needed in newer versions
'python-gpg': 'python3-gpg',
'python': 'python3',
'dovecot-pigeonhole': 'dovecot-sieve'
'dovecot-pigeonhole': 'dovecot-sieve',
'pdns': 'pdns-server',
'pdns-backend-mysql': 'pdns-backend-mysql'
}
elif debian_version >= 12.0:
# Debian 12 (Bookworm)
@@ -152,7 +154,9 @@ def get_debian_mariadb_packages():
'python-minimal': '',
'python-gpg': 'python3-gpg',
'python': 'python3',
'dovecot-pigeonhole': 'dovecot-sieve'
'dovecot-pigeonhole': 'dovecot-sieve',
'pdns': 'pdns-server',
'pdns-backend-mysql': 'pdns-backend-mysql'
}
else:
# Older Debian versions (11 and below)