ports/109137: postfix rc.d startup enhancement, postfix_flags
Jeremy Chadwick
koitsu at FreeBSD.org
Tue Feb 13 16:30:03 UTC 2007
>Number: 109137
>Category: ports
>Synopsis: postfix rc.d startup enhancement, postfix_flags
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Tue Feb 13 16:30:03 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator: Jeremy Chadwick
>Release: FreeBSD 6.2-STABLE i386
>Organization:
>Environment:
System: FreeBSD icarus.home.lan 6.2-STABLE FreeBSD 6.2-STABLE #0: Wed Jan 31 15:39:07 PST 2007 root at icarus.home.lan:/usr/obj/usr/src/sys/ICARUS i386
>Description:
I happen to store many of my postfix configuration files in a
different directory than PREFIX/etc/postfix. I store things
like aliases, generic, main.cf, master.cf, and transport all in
/conf/ME/postfix.
Up until now, my postfix installation/upgrade has consisted
of installing the port, then doing this:
# cd /usr/local/etc/postfix
# rm main.cf master.cf
# ln -s /conf/ME/postfix/main.cf
# ln -s /conf/ME/postfix/master.cf
I came across the manpage entry for postfix(8) which says that
you can use "-c directory" to the postfix start/stop command
to specify an alternate location of a postfix installation, or
use -v or -D for logging verbosity/debugging. I decided to make
a $postfix_flags variable in rc.d/postfix which would allow
these flags to be passed to postfix(8) when starting. Thus I
can now do in rc.conf:
postfix_enable="yes"
postfix_flags="-c /conf/ME/postfix"
...and no longer require symlinks in PREFIX/etc/postfix. (Using
that method also makes a mess when doing a postfix upgrade, since
the configuration backup/restore doesn't handle symlinks how I'd
like. :) No need to change that though.)
There's one caveat: PREFIX/etc/postfix also contains a couple
necessary scripts and files, such as makedefs.out, post-install,
postfix-files, and postfix-script (the most important one).
Those who want to use the -c dir option will have to do something
like this, or else postfix-script and friends won't work:
# cd /conf/ME/postfix
# ln -s /usr/local/etc/postfix/makedefs.out
# ln -s /usr/local/etc/postfix/post-install
# ln -s /usr/local/etc/postfix/postfix-files
# ln -s /usr/local/etc/postfix/postfix-script
The reason for this is that the postfix(8) script explicitly looks
for postfix-script as $config_directory/postfix-script. It's not
a bug; it's just how things are done in postfix(8).
>How-To-Repeat:
n/a
>Fix:
Apply the below patch.
--- files/postfix.sh.in.orig Wed Jul 19 05:59:11 2006
+++ files/postfix.sh.in Tue Feb 13 08:03:25 2007
@@ -14,6 +14,8 @@
# postfix_procname (command): Set command that start master. Used to verify if
# postfix is running.
# Default is "%%PREFIX%%/libexec/postfix/master".
+# postfix_flags (str): Flags passed to postfix-script on start-up.
+# Default is "".
#
. %%RC_SUBR%%
@@ -26,6 +28,7 @@
: ${postfix_enable="NO"}
: ${postfix_pidfile="/var/spool/postfix/pid/master.pid"}
: ${postfix_procname="%%PREFIX%%/libexec/postfix/master"}
+: ${postfix_flags=""}
start_cmd=${name}_start
stop_cmd=${name}_stop
@@ -35,11 +38,11 @@
procname=${postfix_procname}
postfix_start() {
- %%PREFIX%%/sbin/postfix start
+ %%PREFIX%%/sbin/postfix ${postfix_flags} start
}
postfix_stop() {
- %%PREFIX%%/sbin/postfix stop
+ %%PREFIX%%/sbin/postfix ${postfix_flags} stop
}
run_rc_command "$1"
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list