mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
change the was postfix and dovecot are upgrade
This commit is contained in:
@@ -297,7 +297,9 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
|
|||||||
command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data"
|
command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data"
|
||||||
Upgrade.executioner(command, 0)
|
Upgrade.executioner(command, 0)
|
||||||
|
|
||||||
path = "/usr/local/CyberCP/public/rainloop/rainloop/v/1.12.1/include.php"
|
iPath = os.listdir('/usr/local/CyberCP/public/rainloop/rainloop/v/')
|
||||||
|
|
||||||
|
path = "/usr/local/CyberCP/public/rainloop/rainloop/v/%s/include.php" % (iPath[0])
|
||||||
|
|
||||||
data = open(path, 'r').readlines()
|
data = open(path, 'r').readlines()
|
||||||
writeToFile = open(path, 'w')
|
writeToFile = open(path, 'w')
|
||||||
@@ -406,8 +408,8 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
|
|||||||
labsPath = '/usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/configs/application.ini'
|
labsPath = '/usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/configs/application.ini'
|
||||||
|
|
||||||
labsData = """[labs]
|
labsData = """[labs]
|
||||||
imap_folder_list_limit = 0
|
imap_folder_list_limit = 0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
writeToFile = open(labsPath, 'w')
|
writeToFile = open(labsPath, 'w')
|
||||||
writeToFile.write(labsData)
|
writeToFile.write(labsData)
|
||||||
@@ -1846,12 +1848,22 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
|
|||||||
|
|
||||||
if os.path.exists(CentOSPath):
|
if os.path.exists(CentOSPath):
|
||||||
|
|
||||||
if Upgrade.decideCentosVersion() == CENTOS7:
|
### Take backup of configuration files for dovecot
|
||||||
findText = '2:2.3.10-2'
|
|
||||||
else:
|
dovecotConf = '/etc/dovecot/dovecot.conf'
|
||||||
findText = '2.3.10.1-1.gf.el8'
|
dovecotConfBak = '/etc/dovecot.conf'
|
||||||
|
dovecotSQLConf = '/etc/dovecot/dovecot-sql.conf.ext'
|
||||||
|
dovecotSQLConfBak = '/etc/dovecot-sql.conf.ext'
|
||||||
|
|
||||||
|
|
||||||
|
command = 'cp %s %s' % (dovecotConf, dovecotConfBak)
|
||||||
|
Upgrade.executioner(command, 0)
|
||||||
|
|
||||||
|
command = 'cp %s %s' % (dovecotSQLConf, dovecotSQLConfBak)
|
||||||
|
Upgrade.executioner(command, 0)
|
||||||
|
|
||||||
|
### Backup done
|
||||||
|
|
||||||
if Upgrade.installedOutput.find(findText) == -1:
|
|
||||||
command = "yum makecache -y"
|
command = "yum makecache -y"
|
||||||
Upgrade.executioner(command, 0)
|
Upgrade.executioner(command, 0)
|
||||||
|
|
||||||
@@ -1865,25 +1877,16 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
|
|||||||
command = 'dnf install --enablerepo=gf-plus dovecot23 dovecot23-mysql -y'
|
command = 'dnf install --enablerepo=gf-plus dovecot23 dovecot23-mysql -y'
|
||||||
Upgrade.executioner(command, 0)
|
Upgrade.executioner(command, 0)
|
||||||
|
|
||||||
if os.path.exists('/etc/dovecot/dovecot.conf.rpmsave'):
|
### Restore dovecot backup files
|
||||||
if os.path.exists('/etc/dovecot/dovecot.conf'):
|
|
||||||
shutil.move('/etc/dovecot/dovecot.conf', '/etc/dovecot/dovecot.conf.bkcp')
|
|
||||||
shutil.move('/etc/dovecot/dovecot.conf.rpmsave', '/etc/dovecot/dovecot.conf')
|
|
||||||
|
|
||||||
## Remove Default Password Scheme
|
command = 'mv -f %s %s' % (dovecotConfBak, dovecotConf)
|
||||||
|
Upgrade.executioner(command, 0)
|
||||||
|
|
||||||
path = '/etc/dovecot/dovecot-sql.conf.ext'
|
command = 'mv -f %s %s' % (dovecotSQLConfBak, dovecotSQLConf)
|
||||||
|
Upgrade.executioner(command, 0)
|
||||||
|
|
||||||
data = open(path, 'r').readlines()
|
## Dovecot conf resoterd
|
||||||
|
|
||||||
writeToFile = open(path, 'w')
|
|
||||||
for items in data:
|
|
||||||
if items.find('default_pass_scheme') > -1:
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
writeToFile.writelines(items)
|
|
||||||
|
|
||||||
writeToFile.close()
|
|
||||||
|
|
||||||
import django
|
import django
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||||
@@ -1901,26 +1904,18 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
|
|||||||
command = "systemctl restart dovecot"
|
command = "systemctl restart dovecot"
|
||||||
Upgrade.executioner(command, 0)
|
Upgrade.executioner(command, 0)
|
||||||
|
|
||||||
|
|
||||||
### Postfix Upgrade
|
### Postfix Upgrade
|
||||||
|
|
||||||
if Upgrade.decideCentosVersion() == CENTOS7:
|
## Take conf backup
|
||||||
findText = '2:3.4.7-1.gf.el7'
|
|
||||||
else:
|
|
||||||
findText = '3.5.2-1.gf.el8'
|
|
||||||
|
|
||||||
if Upgrade.installedOutput.find(findText) == -1:
|
command = 'mkdir /etc/postfixback'
|
||||||
try:
|
Upgrade.executioner(command, 0)
|
||||||
shutil.copy('/etc/postfix/master.cf', '/etc/master.cf')
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
shutil.copy('/etc/postfix/main.cf', '/etc/main.cf')
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
|
command = 'cp -avr /etc/postfix /etc/postfixback'
|
||||||
|
Upgrade.executioner(command, 0)
|
||||||
|
|
||||||
|
## Restore conf backup
|
||||||
|
|
||||||
command = 'yum remove postfix -y'
|
command = 'yum remove postfix -y'
|
||||||
Upgrade.executioner(command, 0)
|
Upgrade.executioner(command, 0)
|
||||||
@@ -1934,6 +1929,7 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
|
|||||||
command = 'yum makecache -y'
|
command = 'yum makecache -y'
|
||||||
|
|
||||||
Upgrade.executioner(command, 0)
|
Upgrade.executioner(command, 0)
|
||||||
|
|
||||||
if Upgrade.decideCentosVersion() == CENTOS7:
|
if Upgrade.decideCentosVersion() == CENTOS7:
|
||||||
command = 'yum install --enablerepo=CyberPanel -y postfix3 postfix3-mysql'
|
command = 'yum install --enablerepo=CyberPanel -y postfix3 postfix3-mysql'
|
||||||
else:
|
else:
|
||||||
@@ -1941,14 +1937,12 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
|
|||||||
|
|
||||||
Upgrade.executioner(command, 0)
|
Upgrade.executioner(command, 0)
|
||||||
|
|
||||||
try:
|
## Restore conf backups
|
||||||
shutil.move('/etc/master.cf', '/etc/postfix/master.cf')
|
|
||||||
except:
|
command = 'cp -avr /etc/postfixback /etc/postfix'
|
||||||
pass
|
Upgrade.executioner(command, 0)
|
||||||
try:
|
|
||||||
shutil.move('/etc/main.cf', '/etc/postfix/main.cf')
|
##
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
command = 'systemctl restart postfix'
|
command = 'systemctl restart postfix'
|
||||||
Upgrade.executioner(command, 0)
|
Upgrade.executioner(command, 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user