From bf03c651e4f8d77631fe71ec7a4950bfa2e0542d Mon Sep 17 00:00:00 2001 From: rperper Date: Wed, 7 Nov 2018 08:54:16 -0500 Subject: [PATCH] Update for pure-ftpd-mysql having a different service name too --- install/install.py | 15 +++++++-------- install/installCyberPanel.py | 15 ++++++++++++--- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/install/install.py b/install/install.py index 499f170fb..4b6db714e 100644 --- a/install/install.py +++ b/install/install.py @@ -12,6 +12,7 @@ import random import socket from os.path import * from stat import * +import installCyberPanel # There can not be peace without first a great suffering. @@ -1411,7 +1412,7 @@ class preFlightsChecks: fd.close() except IOError as err: 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): @@ -3230,16 +3231,16 @@ milter_default_action = accept return 0 @staticmethod - def enableDisableFTP(state): + def enableDisableFTP(state, distro): try: servicePath = '/home/cyberpanel/pureftpd' if state == 'Off': - command = 'sudo systemctl stop pure-ftpd' + command = 'sudo systemctl stop ' + installCyberPanel.InstallCyberPanel.pureFTPDServiceName(distro) subprocess.call(shlex.split(command)) - command = 'sudo systemctl disable pure-ftpd' + command = 'sudo systemctl disable ' + installCyberPanel.InstallCyberPanel.pureFTPDServiceName(distro) subprocess.call(shlex.split(command)) try: @@ -3358,8 +3359,6 @@ def main(): checks.install_psutil() checks.setup_gunicorn() - import installCyberPanel - installCyberPanel.Main(cwd, mysql, distro) checks.fix_selinux_issue() checks.install_psmisc() @@ -3414,10 +3413,10 @@ def main(): checks.enableDisableDNS('On') if args.ftp != None: - checks.enableDisableFTP(args.ftp) + checks.enableDisableFTP(args.ftp, distro) else: preFlightsChecks.stdOut("Pure-FTPD will be installed and enabled.") - checks.enableDisableFTP('On') + checks.enableDisableFTP('On', distro) logging.InstallLog.writeToFile("CyberPanel installation successfully completed!") checks.installation_successfull() diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index 2beb14adb..d839b6805 100644 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -645,13 +645,21 @@ class InstallCyberPanel: 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): try: count = 0 while (1): if self.distro == ubuntu: - command = 'apt-get -y install pure-ftpd-mysql' + command = 'apt-get -y install ' + InstallCyberPanel.pureFTPDServiceName(self.distro) else: command = "yum install -y pure-ftpd" @@ -676,7 +684,7 @@ class InstallCyberPanel: while(1): - command = "systemctl enable pure-ftpd" + command = "systemctl enable " + InstallCyberPanel.pureFTPDServiceName(self.distro) res = subprocess.call(shlex.split(command)) if res == 1: @@ -763,6 +771,7 @@ class InstallCyberPanel: return 1 + def startPureFTPD(self): ############## Start pureftpd ###################### @@ -776,7 +785,7 @@ class InstallCyberPanel: cmd.append("systemctl") cmd.append("start") - cmd.append("pure-ftpd") + cmd.append(InstallCyberPanel.pureFTPDServiceName(self.distro)) res = subprocess.call(cmd)