Skip to content

Commit

Permalink
some improvements for ubuntu upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Apr 23, 2020
1 parent 554165f commit faa4458
Showing 1 changed file with 41 additions and 28 deletions.
69 changes: 41 additions & 28 deletions plogical/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -1722,37 +1722,40 @@ def upgradeDovecot():
Upgrade.executioner(command, 0)

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

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

debPath = '/etc/apt/sources.list.d/dovecot.list'
writeToFile = open(debPath, 'w')
writeToFile.write('deb https://repo.dovecot.org/ce-2.3-latest/ubuntu/bionic bionic main\n')
writeToFile.close()

try:
command = 'apt update -y'
Upgrade.executioner(command, 0)
except:
pass
command = 'curl https://repo.dovecot.org/DOVECOT-REPO-GPG | gpg --import'
subprocess.call(command, shell=True)

try:
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'
command = 'gpg --export ED409DA1 > /etc/apt/trusted.gpg.d/dovecot.gpg'
subprocess.call(command, shell=True)

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

command = 'apt --fix-broken install -y'
Upgrade.executioner(command, 0)
try:
command = 'apt update -y'
Upgrade.executioner(command, 0)
except:
pass

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'
subprocess.call(command, shell=True)
except:
pass
try:
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'
subprocess.call(command, shell=True)

command = 'dpkg --configure -a'
Upgrade.executioner(command, 0)

command = 'apt --fix-broken install -y'
Upgrade.executioner(command, 0)

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'
subprocess.call(command, shell=True)
except:
pass

## Remove Default Password Scheme

Expand Down Expand Up @@ -1830,11 +1833,13 @@ def installRestic():
command = 'yum install restic -y'
Upgrade.executioner(command, 'Install Restic')
else:
command = 'apt-get update -y'
Upgrade.executioner(command, 'Install Restic')

command = 'apt-get install restic -y'
Upgrade.executioner(command, 'Install Restic')
if Upgrade.installedOutput.find('restic/bionic,now 0.8') == -1:
command = 'apt-get update -y'
Upgrade.executioner(command, 'Install Restic')

command = 'apt-get install restic -y'
Upgrade.executioner(command, 'Install Restic')

@staticmethod
def UpdateMaxSSLCons():
Expand Down Expand Up @@ -1975,6 +1980,10 @@ def upgrade(branch):
if os.path.exists(Upgrade.CentOSPath):
command = 'yum list installed'
Upgrade.installedOutput = subprocess.check_output(shlex.split(command)).decode()
else:
command = 'apt list'
Upgrade.installedOutput = subprocess.check_output(shlex.split(command)).decode()


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

if not os.path.exists('/usr/local/lsws/bin/openlitespeed'):

if os.path.exists('httpd_config.xml'):
os.remove('httpd_config.xml')

command = 'wget https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/install/litespeed/httpd_config.xml'
Upgrade.executioner(command, command, 0)
#os.remove('/usr/local/lsws/conf/httpd_config.xml')
Expand Down

0 comments on commit faa4458

Please sign in to comment.