From b13cdbf0baa42f8a74d97f907c81871e3a9d4c76 Mon Sep 17 00:00:00 2001 From: Spitap Date: Fri, 14 Oct 2022 20:10:39 +0200 Subject: [PATCH] Centos9 support and removed centos7 support --- .github/ISSUE_TEMPLATE.md | 2 +- README.rst | 3 ++- modoboa_installer/database.py | 18 +++--------------- modoboa_installer/scripts/amavis.py | 2 +- modoboa_installer/scripts/clamav.py | 2 +- modoboa_installer/scripts/postfix.py | 11 ----------- modoboa_installer/scripts/uwsgi.py | 2 +- modoboa_installer/ssl.py | 2 +- 8 files changed, 10 insertions(+), 32 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index ac424e4..7355120 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,7 +1,7 @@ # Impacted versions * Distribution: Debian / Ubuntu / Centos -* Codename: Jessie / Trusty / Centos 7 / ... +* Codename: Jessie / Trusty / Centos 9 Stream / ... * Arch: 32 Bits / 64 Bits * Database: PostgreSQL / MySQL diff --git a/README.rst b/README.rst index dd8424e..04da7d7 100644 --- a/README.rst +++ b/README.rst @@ -11,11 +11,12 @@ An installer which deploy a complete mail server based on Modoboa. * Debian Buster (10) / Bullseye (11) * Ubuntu Bionic Beaver (18.04) and upper - * CentOS 7 + * CentOS 9 Stream .. warning:: ``/tmp`` partition must be mounted without the ``noexec`` option. + Centos 7 support has been depreceated since modoboa requires python 3.7>=. .. note:: diff --git a/modoboa_installer/database.py b/modoboa_installer/database.py index d19d8d7..45b3ad7 100644 --- a/modoboa_installer/database.py +++ b/modoboa_installer/database.py @@ -42,7 +42,7 @@ class PostgreSQL(Database): default_port = 5432 packages = { "deb": ["postgresql", "postgresql-server-dev-all"], - "rpm": ["postgresql-server", "postgresql-devel"] + "rpm": ["postgresql-server", "postgresql-server-devel", "postgresql"] } service = "postgresql" @@ -54,20 +54,8 @@ class PostgreSQL(Database): """Install database if required.""" name, version = utils.dist_info() if "CentOS" in name: - if version.startswith("7"): - # Install newer version of postgres in this case - package.backend.install( - "https://download.postgresql.org/pub/repos/yum/" - "reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm" - ) - self.packages["rpm"] = [ - "postgresql10-server", "postgresql10-devel"] - self.service = "postgresql-10" - initdb_cmd = "/usr/pgsql-10/bin/postgresql-10-setup initdb" - cfgfile = "/var/lib/pgsql/10/data/pg_hba.conf" - else: - initdb_cmd = "postgresql-setup initdb" - cfgfile = "/var/lib/pgsql/data/pg_hba.conf" + initdb_cmd = "postgresql-setup initdb" + cfgfile = "/var/lib/pgsql/data/pg_hba.conf" package.backend.install_many(self.packages[package.backend.FORMAT]) utils.exec_cmd(initdb_cmd) pattern = "s/^host(.+)ident$/host$1md5/" diff --git a/modoboa_installer/scripts/amavis.py b/modoboa_installer/scripts/amavis.py index 4fdc187..dabddae 100644 --- a/modoboa_installer/scripts/amavis.py +++ b/modoboa_installer/scripts/amavis.py @@ -22,7 +22,7 @@ class Amavis(base.Installer): "unrar-free", ], "rpm": [ - "amavisd-new", "arj", "lz4", "lzop", "p7zip", + "amavis", "arj", "lz4", "lzop", "p7zip", ], } with_db = True diff --git a/modoboa_installer/scripts/clamav.py b/modoboa_installer/scripts/clamav.py index 60dab36..8cabbdb 100644 --- a/modoboa_installer/scripts/clamav.py +++ b/modoboa_installer/scripts/clamav.py @@ -15,7 +15,7 @@ class Clamav(base.Installer): packages = { "deb": ["clamav-daemon"], "rpm": [ - "clamav", "clamav-update", "clamav-server", "clamav-server-systemd" + "clamav", "clamav-update", "clamd" ], } diff --git a/modoboa_installer/scripts/postfix.py b/modoboa_installer/scripts/postfix.py index 607a905..709a035 100644 --- a/modoboa_installer/scripts/postfix.py +++ b/modoboa_installer/scripts/postfix.py @@ -34,17 +34,6 @@ class Postfix(base.Installer): def install_packages(self): """Preconfigure postfix package installation.""" - if "centos" in utils.dist_name(): - config = configparser.ConfigParser() - with open("/etc/yum.repos.d/CentOS-Base.repo") as fp: - config.read_file(fp) - config.set("centosplus", "enabled", "1") - config.set("centosplus", "includepkgs", "postfix-*") - config.set("base", "exclude", "postfix-*") - config.set("updates", "exclude", "postfix-*") - with open("/etc/yum.repos.d/CentOS-Base.repo", "w") as fp: - config.write(fp) - package.backend.preconfigure( "postfix", "main_mailer_type", "select", "No configuration") super(Postfix, self).install_packages() diff --git a/modoboa_installer/scripts/uwsgi.py b/modoboa_installer/scripts/uwsgi.py index a20e865..6b3823d 100644 --- a/modoboa_installer/scripts/uwsgi.py +++ b/modoboa_installer/scripts/uwsgi.py @@ -17,7 +17,7 @@ class Uwsgi(base.Installer): appname = "uwsgi" packages = { "deb": ["uwsgi", "uwsgi-plugin-python3"], - "rpm": ["uwsgi", "uwsgi-plugin-python36"], + "rpm": ["uwsgi", "uwsgi-plugin-python3"], } def get_socket_path(self, app): diff --git a/modoboa_installer/ssl.py b/modoboa_installer/ssl.py index bd2ef52..e7ee5b3 100644 --- a/modoboa_installer/ssl.py +++ b/modoboa_installer/ssl.py @@ -97,7 +97,7 @@ class LetsEncryptCertificate(CertificateBackend): self.config.has_option("nginx", "enabled") and self.config.getboolean("nginx", "enabled") ): - if name == "ubuntu" or name.startswith("debian"): + if name == "ubuntu" or name.startswith("debian") or ("Centos" in name and version.startswith("9")): package.backend.install("python3-certbot-nginx") def generate_cert(self):