Try to find the dovecot binary in more places.

see #510
This commit is contained in:
Antoine Nguyen
2014-01-24 10:21:16 +01:00
parent 6a0e82355e
commit 71ddb0837b
3 changed files with 16 additions and 1 deletions
+9
View File
@@ -55,6 +55,15 @@ For dovecot 2.0 and older, use the `autocreate
Operations on the file system
-----------------------------
.. warning::
Modoboa needs to access the ``dovecot`` binary to check its
version. To find the binary path, we use the ``which`` command
first and then try known locations (:file:`/usr/sbin/dovecot` and
:file:`/usr/local/sbin/dovecot`). If you installed dovecot in a
custom location, please tell us where the binary is by using the
``DOVECOT_LOOKUP_PATH`` setting (see :file:`settings.py`).
Three operation types are considered:
#. Mailbox creation
@@ -172,6 +172,8 @@ SOUTH_TESTS_MIGRATE = False
#MODOBOA_CUSTOM_LOGO = os.path.join(MEDIA_URL, "custom_logo.png")
#DOVECOT_LOOKUP_PATH = ('/path/to/dovecot', )
AUTHENTICATION_BACKENDS = (
'modoboa.lib.authbackends.SimpleBackend',
)
+5 -1
View File
@@ -1,4 +1,5 @@
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy
from modoboa.lib.formutils import YesNoField, SeparatorField
from modoboa.lib.sysutils import exec_cmd
@@ -49,10 +50,13 @@ class AdminParametersForm(parameters.AdminParametersForm):
hide_fields = False
dpath = None
code, output = exec_cmd("which dovecot")
known_paths = ("/usr/sbin/dovecot", "/usr/local/sbin/dovecot")
if not code:
dpath = output.strip()
else:
known_paths = getattr(
settings, "DOVECOT_LOOKUP_PATH",
("/usr/sbin/dovecot", "/usr/local/sbin/dovecot")
)
for fpath in known_paths:
if os.path.isfile(fpath) and os.access(fpath, os.X_OK):
dpath = fpath