Update for pure-ftpd-mysql having a different service name too

This commit is contained in:
rperper
2018-11-07 08:54:16 -05:00
parent 0e40a8030d
commit bf03c651e4
2 changed files with 19 additions and 11 deletions

View File

@@ -12,6 +12,7 @@ import random
import socket import socket
from os.path import * from os.path import *
from stat import * from stat import *
import installCyberPanel
# There can not be peace without first a great suffering. # There can not be peace without first a great suffering.
@@ -1411,7 +1412,7 @@ class preFlightsChecks:
fd.close() fd.close()
except IOError as err: except IOError as err:
self.stdOut("Error converting: " + filename + " from centos defaults to ubuntu defaults: " + str(err), 1, self.stdOut("Error converting: " + filename + " from centos defaults to ubuntu defaults: " + str(err), 1,
1, EX_OSERR) 1, os.EX_OSERR)
def setup_postfix_davecot_config(self, mysql): def setup_postfix_davecot_config(self, mysql):
@@ -3230,16 +3231,16 @@ milter_default_action = accept
return 0 return 0
@staticmethod @staticmethod
def enableDisableFTP(state): def enableDisableFTP(state, distro):
try: try:
servicePath = '/home/cyberpanel/pureftpd' servicePath = '/home/cyberpanel/pureftpd'
if state == 'Off': if state == 'Off':
command = 'sudo systemctl stop pure-ftpd' command = 'sudo systemctl stop ' + installCyberPanel.InstallCyberPanel.pureFTPDServiceName(distro)
subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
command = 'sudo systemctl disable pure-ftpd' command = 'sudo systemctl disable ' + installCyberPanel.InstallCyberPanel.pureFTPDServiceName(distro)
subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
try: try:
@@ -3358,8 +3359,6 @@ def main():
checks.install_psutil() checks.install_psutil()
checks.setup_gunicorn() checks.setup_gunicorn()
import installCyberPanel
installCyberPanel.Main(cwd, mysql, distro) installCyberPanel.Main(cwd, mysql, distro)
checks.fix_selinux_issue() checks.fix_selinux_issue()
checks.install_psmisc() checks.install_psmisc()
@@ -3414,10 +3413,10 @@ def main():
checks.enableDisableDNS('On') checks.enableDisableDNS('On')
if args.ftp != None: if args.ftp != None:
checks.enableDisableFTP(args.ftp) checks.enableDisableFTP(args.ftp, distro)
else: else:
preFlightsChecks.stdOut("Pure-FTPD will be installed and enabled.") preFlightsChecks.stdOut("Pure-FTPD will be installed and enabled.")
checks.enableDisableFTP('On') checks.enableDisableFTP('On', distro)
logging.InstallLog.writeToFile("CyberPanel installation successfully completed!") logging.InstallLog.writeToFile("CyberPanel installation successfully completed!")
checks.installation_successfull() checks.installation_successfull()

View File

@@ -645,13 +645,21 @@ class InstallCyberPanel:
self.stdOut("MariaDB is now setup so it can support Cyberpanel's needs") self.stdOut("MariaDB is now setup so it can support Cyberpanel's needs")
@staticmethod
def pureFTPDServiceName(self, distro):
if distro == 'ubuntu'
return 'pure-ftpd-mysql'
return 'pure-ftpd'
def installPureFTPD(self): def installPureFTPD(self):
try: try:
count = 0 count = 0
while (1): while (1):
if self.distro == ubuntu: if self.distro == ubuntu:
command = 'apt-get -y install pure-ftpd-mysql' command = 'apt-get -y install ' + InstallCyberPanel.pureFTPDServiceName(self.distro)
else: else:
command = "yum install -y pure-ftpd" command = "yum install -y pure-ftpd"
@@ -676,7 +684,7 @@ class InstallCyberPanel:
while(1): while(1):
command = "systemctl enable pure-ftpd" command = "systemctl enable " + InstallCyberPanel.pureFTPDServiceName(self.distro)
res = subprocess.call(shlex.split(command)) res = subprocess.call(shlex.split(command))
if res == 1: if res == 1:
@@ -763,6 +771,7 @@ class InstallCyberPanel:
return 1 return 1
def startPureFTPD(self): def startPureFTPD(self):
############## Start pureftpd ###################### ############## Start pureftpd ######################
@@ -776,7 +785,7 @@ class InstallCyberPanel:
cmd.append("systemctl") cmd.append("systemctl")
cmd.append("start") cmd.append("start")
cmd.append("pure-ftpd") cmd.append(InstallCyberPanel.pureFTPDServiceName(self.distro))
res = subprocess.call(cmd) res = subprocess.call(cmd)