upgrade: postfix3

This commit is contained in:
Usman Nasir
2019-08-30 20:15:09 +05:00
parent 7b7549dd25
commit 1ef69f9e36
4 changed files with 71 additions and 5 deletions

View File

@@ -1276,6 +1276,11 @@ enabled=1"""
try: try:
if self.distro == centos: if self.distro == centos:
command = 'yum -y install http://cyberpanel.sh/gf-release-latest.gf.el7.noarch.rpm'
subprocess.call(shlex.split(command))
command = 'yum remove postfix -y' command = 'yum remove postfix -y'
else: else:
command = 'apt-get -y remove postfix' command = 'apt-get -y remove postfix'
@@ -1286,7 +1291,7 @@ enabled=1"""
count = 0 count = 0
while (1): while (1):
if self.distro == centos: if self.distro == centos:
command = 'yum install -y postfix' command = 'yum install --enablerepo=gf-plus -y postfix3 postfix3-ldap postfix3-mysql postfix3-pcre'
else: else:
command = 'apt-get -y debconf-utils' command = 'apt-get -y debconf-utils'
subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))

View File

@@ -5,7 +5,6 @@ import os
import socket import socket
import threading as multi import threading as multi
import time import time
from pipes import quote
class ProcessUtilities(multi.Thread): class ProcessUtilities(multi.Thread):
litespeedProcess = "litespeed" litespeedProcess = "litespeed"
@@ -198,8 +197,6 @@ class ProcessUtilities(multi.Thread):
command = command.replace('sudo', '') command = command.replace('sudo', '')
sock.sendall(command) sock.sendall(command)
logging.writeToFile(command)
data = "" data = ""
while (1): while (1):

View File

@@ -1595,6 +1595,71 @@ enabled=1"""
command = "systemctl restart dovecot" command = "systemctl restart dovecot"
Upgrade.executioner(command, 0) Upgrade.executioner(command, 0)
### Postfix Upgrade
try:
shutil.copy('/etc/postfix/master.cf', '/etc/master.cf')
except:
pass
try:
shutil.copy('/etc/postfix/main.cf', '/etc/main.cf')
except:
pass
gf = '/etc/yum.repos.d/gf.repo'
gfContent = """[gf]
name=Ghettoforge packages that won't overwrite core distro packages.
mirrorlist=http://mirrorlist.ghettoforge.org/el/7/gf/$basearch/mirrorlist
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-gf.el7
failovermethod=priority
[gf-plus]
name=Ghettoforge packages that will overwrite core distro packages.
mirrorlist=http://mirrorlist.ghettoforge.org/el/7/plus/$basearch/mirrorlist
# Please read http://ghettoforge.org/index.php/Usage *before* enabling this repository!
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-gf.el7
failovermethod=priority
"""
writeToFile = open(gf, 'w')
writeToFile.write(gfContent)
writeToFile.close()
command = 'yum remove postfix -y'
Upgrade.executioner(command, 0)
command = 'rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm'
Upgrade.executioner(command, 0)
command = 'yum clean all'
Upgrade.executioner(command, 0)
command = 'yum makecache fast'
Upgrade.executioner(command, 0)
command = 'yum install -y postfix3 postfix3-mysql'
Upgrade.executioner(command, 0)
try:
shutil.move('/etc/master.cf', '/etc/postfix/master.cf')
except:
pass
try:
shutil.move('/etc/main.cf', '/etc/postfix/main.cf')
except:
pass
command = 'systemctl restart postfix'
Upgrade.executioner(command, 0)
else: else:
command = 'curl https://repo.dovecot.org/DOVECOT-REPO-GPG | gpg --import' command = 'curl https://repo.dovecot.org/DOVECOT-REPO-GPG | gpg --import'
subprocess.call(command, shell=True) subprocess.call(command, shell=True)

View File

@@ -66,7 +66,6 @@ class SetupConn:
except BaseException, msg: except BaseException, msg:
logging.writeToFile(str(msg) + ' [SetupConn.start_listening]') logging.writeToFile(str(msg) + ' [SetupConn.start_listening]')
def __del__(self): def __del__(self):
self.sock.close() self.sock.close()
logging.writeToFile('Closing open connections!') logging.writeToFile('Closing open connections!')