Make sure /etc/mailname file exists before amavis is installed.

see #1801
This commit is contained in:
Antoine Nguyen
2020-03-05 11:19:19 +01:00
parent b5aa1bc7e7
commit 7d06f9aaf1
2 changed files with 10 additions and 2 deletions

View File

@@ -78,9 +78,12 @@ class Amavis(base.Installer):
raise utils.FatalError("Failed to find amavis database schema") raise utils.FatalError("Failed to find amavis database schema")
return path return path
def post_run(self): def pre_run(self):
"""Additional tasks.""" """Tasks to run first."""
with open("/etc/mailname", "w") as fp: with open("/etc/mailname", "w") as fp:
fp.write("{}\n".format(self.config.get("general", "hostname"))) fp.write("{}\n".format(self.config.get("general", "hostname")))
def post_run(self):
"""Additional tasks."""
install("spamassassin", self.config, self.upgrade) install("spamassassin", self.config, self.upgrade)
install("clamav", self.config, self.upgrade) install("clamav", self.config, self.upgrade)

View File

@@ -147,6 +147,7 @@ class Installer(object):
def run(self): def run(self):
"""Run the installer.""" """Run the installer."""
self.pre_run()
self.install_packages() self.install_packages()
self.setup_user() self.setup_user()
if not self.upgrade: if not self.upgrade:
@@ -155,6 +156,10 @@ class Installer(object):
self.post_run() self.post_run()
self.restart_daemon() self.restart_daemon()
def pre_run(self):
"""Tasks to execute before the installer starts."""
pass
def post_run(self): def post_run(self):
"""Additionnal tasks.""" """Additionnal tasks."""
pass pass