fix dovecot upgrade on ubuntu

This commit is contained in:
Usman Nasir 2021-03-18 15:20:34 +05:00
parent 3b725a8523
commit 1aaaefb3bf
2 changed files with 28 additions and 30 deletions

View File

@ -427,17 +427,19 @@ elif [[ "$Server_OS" = "Ubutnu" ]] ; then
:
#all pre-upgrade operation for Ubuntu 18
elif [[ "$Server_OS_Version" = "20" ]] ; then
if ! grep -q "focal" /etc/apt/sources.list.d/dovecot.list ; then
sed -i 's|ce-2.3-latest/ubuntu/bionic bionic main|ce-2.3-latest/ubuntu/focal focal main|g' /etc/apt/sources.list.d/dovecot.list
rm -rf /etc/dovecot-backup
cp -r /etc/dovecot /etc/dovecot-backup
apt update
DEBIAN_FRONTEND=noninteractive apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" remove -y dovecot-mysql dovecot-pop3d dovecot-imapd
DEBIAN_FRONTEND=noninteractive apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -y dovecot-mysql dovecot-pop3d dovecot-imapd
systemctl restart dovecot
fi
#fix ubuntu 20 webmail login issue
# if ! grep -q "focal" /etc/apt/sources.list.d/dovecot.list ; then
# sed -i 's|ce-2.3-latest/ubuntu/bionic bionic main|ce-2.3-latest/ubuntu/focal focal main|g' /etc/apt/sources.list.d/dovecot.list
# rm -rf /etc/dovecot-backup
# cp -r /etc/dovecot /etc/dovecot-backup
# apt update
# DEBIAN_FRONTEND=noninteractive apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" remove -y dovecot-mysql dovecot-pop3d dovecot-imapd
# DEBIAN_FRONTEND=noninteractive apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -y dovecot-mysql dovecot-pop3d dovecot-imapd
# systemctl restart dovecot
# fi
#fix ubuntu 20 webmail login issue
rm -f /etc/apt/sources.list.d/dovecot.list
apt update
fi
#all pre-upgrade operation for Ubuntu 20
fi

View File

@ -2168,25 +2168,21 @@ echo $oConfig->Save() ? 'Done' : 'Error';
elif Upgrade.FindOperatingSytem() == Ubuntu20:
debPath = '/etc/apt/sources.list.d/dovecot.list'
writeToFile = open(debPath, 'w')
writeToFile.write('deb https://repo.dovecot.org/ce-2.3-latest/ubuntu/focal focal main\n')
writeToFile.close()
command = "apt update -y"
Upgrade.executioner(command, command)
command = 'dpkg --configure -a'
subprocess.call(command, shell=True)
command = 'apt --fix-broken install -y'
subprocess.call(command, shell=True)
command = 'DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade -y'
subprocess.call(command, shell=True)
# writeToFile = open(debPath, 'w')
# writeToFile.write('deb https://repo.dovecot.org/ce-2.3-latest/ubuntu/focal focal main\n')
# writeToFile.close()
#
# command = "apt update -y"
# Upgrade.executioner(command, command)
#
# command = 'dpkg --configure -a'
# subprocess.call(command, shell=True)
#
# command = 'apt --fix-broken install -y'
# subprocess.call(command, shell=True)
#
# command = 'DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade -y'
# subprocess.call(command, shell=True)
dovecotConf = '/etc/dovecot/dovecot.conf'