From 7d06f9aaf1d79667f561c0f384cd972b614edb60 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Thu, 5 Mar 2020 11:19:19 +0100 Subject: [PATCH] Make sure /etc/mailname file exists before amavis is installed. see #1801 --- modoboa_installer/scripts/amavis.py | 7 +++++-- modoboa_installer/scripts/base.py | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modoboa_installer/scripts/amavis.py b/modoboa_installer/scripts/amavis.py index d4a8c43..6635241 100644 --- a/modoboa_installer/scripts/amavis.py +++ b/modoboa_installer/scripts/amavis.py @@ -78,9 +78,12 @@ class Amavis(base.Installer): raise utils.FatalError("Failed to find amavis database schema") return path - def post_run(self): - """Additional tasks.""" + def pre_run(self): + """Tasks to run first.""" with open("/etc/mailname", "w") as fp: fp.write("{}\n".format(self.config.get("general", "hostname"))) + + def post_run(self): + """Additional tasks.""" install("spamassassin", self.config, self.upgrade) install("clamav", self.config, self.upgrade) diff --git a/modoboa_installer/scripts/base.py b/modoboa_installer/scripts/base.py index e619d6f..8f61e5d 100644 --- a/modoboa_installer/scripts/base.py +++ b/modoboa_installer/scripts/base.py @@ -147,6 +147,7 @@ class Installer(object): def run(self): """Run the installer.""" + self.pre_run() self.install_packages() self.setup_user() if not self.upgrade: @@ -155,6 +156,10 @@ class Installer(object): self.post_run() self.restart_daemon() + def pre_run(self): + """Tasks to execute before the installer starts.""" + pass + def post_run(self): """Additionnal tasks.""" pass