Bug 248664

Summary: mail/dovecot: complains about missing configuration file even if not enabled
Product: Ports & Packages Reporter: Martin Birgmeier <d8zNeCFG>
Component: Individual Port(s)Assignee: Larry Rosenman <ler>
Status: New ---    
Severity: Affects Only Me CC: chris, portmaster, zab
Priority: --- Flags: bugzilla: maintainer-feedback? (ler)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
fix /usr/local/etc/dovecot if dovecot_enable="no" none

Description Martin Birgmeier 2020-08-15 06:13:35 UTC
Scenario:
- FreeBSD 12.1
- latest ports
- dovecot installed but not enabled in rc.conf

Result:
- the dovecot script in /usr/local/etc/rc.d complains about a missing configuration file:

==Error==
Config file /usr/local/etc/dovecot/dovecot.conf does not exist. If this is
a new installation, please create the config files as outlined in
        # pkg info -D dovecot

Expected result:
- If dovecot is not enabled it should not require a configuration file to exist

-- Martin
Comment 1 Chris Hutchinson 2020-08-22 08:53:43 UTC
I'd like to confirm the same on ports @r544342

The problem is in the way the dovecot init script
attempts to accommodate multiple instances. It's
done incorrectly and emits:

doveconf: Fatal: Error in configuration file /usr/local/etc/dovecot/dovecot.conf
 line 106: No matches
==Error==
Configuration file check failed.
# 2.3.10.1 (a3d0e1171): /usr/local/etc/dovecot/dovecot.conf
doveconf: Fatal: Error in configuration file /usr/local/etc/dovecot/dovecot.conf
 line 106: No matches

the init script revision is:
FreeBSD: head/mail/dovecot/files/dovecot.in 483490 2018-10-30 14:04:21Z ler

--Chris
Comment 2 Zoltan ALEXANDERSON BESSE 2020-11-12 20:48:21 UTC
Created attachment 219609 [details]
fix /usr/local/etc/dovecot if dovecot_enable="no"

It is very rare installing dovecot without enabling.
Nevertheless, attached patch adds an "exit 0;" into "/usr/local/etc/dovecot" before the final check-loop for terminating script if dovecot_enable set to NO. (or unset)

(btw, there are several other ways to fix this.)