From 85e76c1981fbc8bacd4a6108bed042d086a3c3d3 Mon Sep 17 00:00:00 2001 From: Daniel Leicht Date: Wed, 28 Oct 2020 15:30:09 +0200 Subject: [PATCH] Fixed dist_info() case sensitivity for certbot installation On Debian 10, dist_info() returns a lower case "debian" and the installation of certbot fails. I changed the installation method to check the distribution name in case insensitive way. --- modoboa_installer/ssl.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modoboa_installer/ssl.py b/modoboa_installer/ssl.py index d4f16ea..414ba0f 100644 --- a/modoboa_installer/ssl.py +++ b/modoboa_installer/ssl.py @@ -75,7 +75,8 @@ class LetsEncryptCertificate(CertificateBackend): def install_certbot(self): """Install certbot script to generate cert.""" name, version, _id = utils.dist_info() - if name == "Ubuntu": + name = name.lower() + if name == "ubuntu": package.backend.update() package.backend.install("software-properties-common") utils.exec_cmd("add-apt-repository -y universe") @@ -83,10 +84,10 @@ class LetsEncryptCertificate(CertificateBackend): utils.exec_cmd("add-apt-repository -y ppa:certbot/certbot") package.backend.update() package.backend.install("certbot") - elif name == "Debian": + elif name == "debian": package.backend.update() package.backend.install("certbot") - elif "CentOS" in name: + elif "centos" in name: package.backend.install("certbot") else: utils.printcolor("Failed to install certbot, aborting.", utils.RED)