[Bug 280967] mail/dovecot: Silence warnings from rc script if dovecot_enable != YES

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 21 Aug 2024 05:58:47 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280967

            Bug ID: 280967
           Summary: mail/dovecot: Silence warnings from rc script if
                    dovecot_enable != YES
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ler@FreeBSD.org
          Reporter: john@jmarshall.id.au
          Assignee: ler@FreeBSD.org
             Flags: maintainer-feedback?(ler@FreeBSD.org)

Created attachment 252976
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=252976&action=edit
[PATCH] Silence rc script warning unless dovecot_enable = YES

If the dovecot rc script cannot find a dovecot configuration file, it will
complain - even if there are no dovecot_* variables defined in rc.conf (or
friends).

----------------
rwsrv08# service dovecot rcvar
==Error==
Config file /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
# dovecot
#
dovecot_enable="NO"
#   (default: "")
----------------

I don't see the point of complaining loudly about a missing configuration file
unless the user is trying to start the product.

The attached patch skips emitting the missing file warning unless:
 - dovecot_enable = YES; or
 - $1 = onestart.

[I build dovecot on the base system, package it, and install that package in a
jail. I don't have it configured to run on the base system. It irritates me
seeing that warning message whenever I boot the base system.]

WITH PATCH APPLIED
------------------
rwsrv08# service dovecot rcvar
# dovecot
#
dovecot_enable="NO"
#   (default: "")

rwsrv08# 
rwsrv08# 
rwsrv08# service dovecot onestart
==Error==
Config file /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
/usr/local/etc/rc.d/dovecot: WARNING: /local/etc/dovecot/dovecot.conf is not
readable.
/usr/local/etc/rc.d/dovecot: WARNING: failed precmd routine for dovecot
rwsrv08# 
------------------

Thank you for maintaining this port.

-- 
You are receiving this mail because:
You are the assignee for the bug.