Few fixes.

Ubuntu installation (fix #4)
Generate map files when all shortcut is used (see #8)
Fix freshclam execution on Ubuntu
This commit is contained in:
Antoine Nguyen
2015-11-06 09:45:05 +01:00
parent 1824707d76
commit 5496f0caef
7 changed files with 41 additions and 16 deletions

View File

@@ -20,4 +20,10 @@ class Clamav(base.Installer):
system.add_user_to_group(
user, self.config.get("amavis", "user")
)
utils.exec_cmd("freshclam", sudo_user=user)
if utils.dist_name == "ubuntu":
# Stop freshclam daemon to allow manual download
utils.exec_cmd("service clamav-freshclam stop")
utils.exec_cmd("freshclam", sudo_user=user)
utils.exec_cmd("service clamav-freshclam start")
else:
utils.exec_cmd("freshclam", sudo_user=user)

View File

@@ -33,6 +33,13 @@ class Dovecot(base.Installer):
"""Additional packages."""
return self.packages + ["dovecot-{}".format(self.db_driver)]
def install_packages(self):
"""Preconfigure Dovecot if needed."""
if utils.dist_name() == "ubuntu":
utils.preconfigure_package(
"dovecot-core", "create-ssl-cert", "boolean", "false")
super(Dovecot, self).install_packages()
def get_template_context(self):
"""Additional variables."""
context = super(Dovecot, self).get_template_context()

View File

@@ -21,8 +21,8 @@ class Postfix(base.Installer):
def install_packages(self):
"""Preconfigure postfix package installation."""
cfg = "postfix postfix/main_mailer_type select No configuration"
utils.exec_cmd("echo '{}' | debconf-set-selections".format(cfg))
utils.preconfigure_package(
"postfix", "main_mailer_type", "select", "No configuration")
super(Postfix, self).install_packages()
def get_template_context(self):
@@ -51,9 +51,12 @@ class Postfix(base.Installer):
extensions = self.config.get("modoboa", "extensions")
exts_with_maps = ["modoboa-admin", "modoboa-admin-relaydomains",
"modoboa-postfix-autoreply"]
extensions = [ext for ext in exts_with_maps if ext in extensions]
if not extensions:
return
if extensions == "all":
extensions = exts_with_maps
else:
extensions = [ext for ext in exts_with_maps if ext in extensions]
if not extensions:
return
cmd = (
"{} {} postfix_maps --dbtype {} --extensions {} --dburl {} {}"
.format(python_path, script_path, self.dbengine,