Skip to content

Commit faa4458

Browse files
committed
some improvements for ubuntu upgrade
1 parent 554165f commit faa4458

1 file changed

Lines changed: 41 additions & 28 deletions

File tree

plogical/upgrade.py

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,37 +1722,40 @@ def upgradeDovecot():
17221722
Upgrade.executioner(command, 0)
17231723

17241724
else:
1725-
command = 'curl https://repo.dovecot.org/DOVECOT-REPO-GPG | gpg --import'
1726-
subprocess.call(command, shell=True)
17271725

1728-
command = 'gpg --export ED409DA1 > /etc/apt/trusted.gpg.d/dovecot.gpg'
1729-
subprocess.call(command, shell=True)
1726+
if Upgrade.installedOutput.find('dovecot-mysql/bionic,now 2:2.3.10-2') == -1:
17301727

1731-
debPath = '/etc/apt/sources.list.d/dovecot.list'
1732-
writeToFile = open(debPath, 'w')
1733-
writeToFile.write('deb https://repo.dovecot.org/ce-2.3-latest/ubuntu/bionic bionic main\n')
1734-
writeToFile.close()
1735-
1736-
try:
1737-
command = 'apt update -y'
1738-
Upgrade.executioner(command, 0)
1739-
except:
1740-
pass
1728+
command = 'curl https://repo.dovecot.org/DOVECOT-REPO-GPG | gpg --import'
1729+
subprocess.call(command, shell=True)
17411730

1742-
try:
1743-
command = 'DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical sudo apt-get -q -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" --only-upgrade install dovecot-mysql -y'
1731+
command = 'gpg --export ED409DA1 > /etc/apt/trusted.gpg.d/dovecot.gpg'
17441732
subprocess.call(command, shell=True)
17451733

1746-
command = 'dpkg --configure -a'
1747-
Upgrade.executioner(command, 0)
1734+
debPath = '/etc/apt/sources.list.d/dovecot.list'
1735+
writeToFile = open(debPath, 'w')
1736+
writeToFile.write('deb https://repo.dovecot.org/ce-2.3-latest/ubuntu/bionic bionic main\n')
1737+
writeToFile.close()
17481738

1749-
command = 'apt --fix-broken install -y'
1750-
Upgrade.executioner(command, 0)
1739+
try:
1740+
command = 'apt update -y'
1741+
Upgrade.executioner(command, 0)
1742+
except:
1743+
pass
17511744

1752-
command = 'DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical sudo apt-get -q -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" --only-upgrade install dovecot-mysql -y'
1753-
subprocess.call(command, shell=True)
1754-
except:
1755-
pass
1745+
try:
1746+
command = 'DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical sudo apt-get -q -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" --only-upgrade install dovecot-mysql -y'
1747+
subprocess.call(command, shell=True)
1748+
1749+
command = 'dpkg --configure -a'
1750+
Upgrade.executioner(command, 0)
1751+
1752+
command = 'apt --fix-broken install -y'
1753+
Upgrade.executioner(command, 0)
1754+
1755+
command = 'DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical sudo apt-get -q -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" --only-upgrade install dovecot-mysql -y'
1756+
subprocess.call(command, shell=True)
1757+
except:
1758+
pass
17561759

17571760
## Remove Default Password Scheme
17581761

@@ -1830,11 +1833,13 @@ def installRestic():
18301833
command = 'yum install restic -y'
18311834
Upgrade.executioner(command, 'Install Restic')
18321835
else:
1833-
command = 'apt-get update -y'
1834-
Upgrade.executioner(command, 'Install Restic')
18351836

1836-
command = 'apt-get install restic -y'
1837-
Upgrade.executioner(command, 'Install Restic')
1837+
if Upgrade.installedOutput.find('restic/bionic,now 0.8') == -1:
1838+
command = 'apt-get update -y'
1839+
Upgrade.executioner(command, 'Install Restic')
1840+
1841+
command = 'apt-get install restic -y'
1842+
Upgrade.executioner(command, 'Install Restic')
18381843

18391844
@staticmethod
18401845
def UpdateMaxSSLCons():
@@ -1975,6 +1980,10 @@ def upgrade(branch):
19751980
if os.path.exists(Upgrade.CentOSPath):
19761981
command = 'yum list installed'
19771982
Upgrade.installedOutput = subprocess.check_output(shlex.split(command)).decode()
1983+
else:
1984+
command = 'apt list'
1985+
Upgrade.installedOutput = subprocess.check_output(shlex.split(command)).decode()
1986+
19781987

19791988
command = 'systemctl stop cpssh'
19801989
Upgrade.executioner(command, 'fix csf if there', 0)
@@ -1983,6 +1992,10 @@ def upgrade(branch):
19831992
## Add LSPHP7.4 TO LSWS Ent configs
19841993

19851994
if not os.path.exists('/usr/local/lsws/bin/openlitespeed'):
1995+
1996+
if os.path.exists('httpd_config.xml'):
1997+
os.remove('httpd_config.xml')
1998+
19861999
command = 'wget https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/install/litespeed/httpd_config.xml'
19872000
Upgrade.executioner(command, command, 0)
19882001
#os.remove('/usr/local/lsws/conf/httpd_config.xml')

0 commit comments

Comments
 (0)