Date: Tue, 14 May 2013 19:33:55 GMT From: Darren Pilgrim <ports.maintainer@evilphi.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/178644: Redesign postgrey RC script, other small tweaks Message-ID: <201305141933.r4EJXttX037182@oldred.FreeBSD.org> Resent-Message-ID: <201305141940.r4EJe0uv022243@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 178644 >Category: ports >Synopsis: Redesign postgrey RC script, other small tweaks >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Tue May 14 19:40:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Darren Pilgrim >Release: n/a >Organization: >Environment: n/a >Description: - Patch postgrey to use PGY_GROUPNAME by default; - Make the DOCS option transparent (no dialog); - Remove PGY_USERID and PGY_GROUPID (not used); - PGY_GROUPNAME no longer follows PGY_USERNAME; - Bump PORTREVISION. After feedback from multiple users, I redesigned the RC script: - Always prepend -d, --pidfile, and --dbdir options, even if you override postgrey_flags; - The dbdir path is set using the postgrey_dbdir variable; - Trust postgrey to use its defaults (dropped user, group, and x-greylist-header from the default postgrey_flags); - Do not set a listening option (inet/unix) by default--user must set one explicitly via postgrey_flags before postgrey will run. >How-To-Repeat: n/a >Fix: Update patch attached. Patch attached with submission follows: --- Makefile.orig 2013-05-12 07:29:46.000000000 -0700 +++ Makefile 2013-05-14 12:28:17.569002494 -0700 @@ -3,7 +3,7 @@ PORTNAME= postgrey PORTVERSION= 1.34 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= mail MASTER_SITES= http://postgrey.schweikert.ch/pub/ \ http://postgrey.schweikert.ch/pub/old/ @@ -23,14 +23,13 @@ POD2MAN?= pod2man PORTDOCS= README Changes README.exim SUB_FILES= pkg-install -SUB_LIST= USER=${PGY_USERNAME} UID=${PGY_USERID} GROUP=${PGY_GROUPNAME} \ - GID=${PGY_GROUPID} ETCFILES="${ETCFILES}" \ +SUB_LIST= USER=${PGY_USERNAME} \ + GROUP=${PGY_GROUPNAME} \ + ETCFILES="${ETCFILES}" \ POSTGREYDIR=${PGY_DIR} ETCFILES= whitelist_clients whitelist_recipients PGY_USERNAME?= postgrey -PGY_USERID?= 225 -PGY_GROUPNAME?= ${PGY_USERNAME} -PGY_GROUPID?= ${PGY_USERID} +PGY_GROUPNAME?= postgrey PGY_DIR?= /var/db/postgrey USERS= ${PGY_USERNAME} @@ -40,12 +39,10 @@ USES= shebangfix SHEBANG_FILES= ${WRKSRC}/postgrey -OPTIONS_DEFINE= DOCS -OPTIONS_DEFAULT=DOCS - .include <bsd.port.options.mk> post-patch: + @${REINPLACE_CMD} -e 's#nogroup#${PGY_GROUPNAME}#' ${WRKSRC}/postgrey @${REINPLACE_CMD} -e 's#/etc/main.cf#/etc/postfix/main.cf#' ${WRKSRC}/postgrey @${REINPLACE_CMD} -e 's#/etc/postfix#${PREFIX}&#' ${WRKSRC}/postgrey ${WRKSRC}/postgrey_whitelist_* @${REINPLACE_CMD} -e 's#/var/spool/postfix/postgrey#${PGY_DIR}#' ${WRKSRC}/postgrey ${WRKSRC}/contrib/postgreyreport --- files/pkg-install.in.orig 2013-05-14 12:10:48.687037566 -0700 +++ files/pkg-install.in 2013-05-14 12:12:41.785144004 -0700 @@ -7,15 +7,10 @@ case $2 in PRE-INSTALL) - echo "---> Starting install script:" - - if [ -z "%%POSTGREYDIR%%" -o \ - -z "%%USER%%" -o -z "%%GROUP%%" -o \ - -z "%%UID%%" -o -z "%%GID%%" ]; then + if [ -z "%%POSTGREYDIR%%" -o -z "%%USER%%" -o -z "%%GROUP%%" ]; then echo "ERROR: A required pragma was empty" exit 1 fi - ;; POST-INSTALL) --- files/postgrey.in.orig 2012-07-14 06:54:48.000000000 -0700 +++ files/postgrey.in 2013-05-14 10:58:09.883124044 -0700 @@ -7,23 +7,42 @@ # BEFORE: mail # KEYWORD: shutdown -# # Add the following lines to /etc/rc.conf to enable postgrey: # # postgrey_enable="YES" # -# See perldoc postgrey for flags +# You must specify listening on a TCP socket (--inet option) or +# unix socket (--unix) in postgrey_flags: +# +# postgrey_flags="--inet=PORT" +# +# -OR- +# +# postgrey_flags="--unix=/path/to/socket" # +# By default, postgrey uses /var/db/postgrey for its databases. +# You can change this location using the postgrey_dbdir option. +# +# You can set extra command-line flags in postgrey_flags as well. +# See the postgrey(1) man page or perldoc postgrey for options. . /etc/rc.subr name=postgrey -rcvar=postgrey_enable + +load_rc_config $name + +: ${postgrey_enable:="NO"} +: ${postgrey_dbdir:="/var/db/postgrey"} +: ${postgrey_flags:=""} command=%%PREFIX%%/sbin/postgrey -required_dirs=/var/db/postgrey +pidfile=/var/run/postgrey.pid +required_dirs=${postgrey_dbdir} extra_commands=reload +postgrey_flags="-d --pidfile=${pidfile} --dbdir=${postgrey_dbdir} ${postgrey_flags}" + stop_postcmd=stop_postcmd stop_postcmd() @@ -31,17 +50,4 @@ rm -f $pidfile } -# set defaults - -load_rc_config $name - -postgrey_enable=${postgrey_enable:-"NO"} -postgrey_greylist_header=${postgrey_greylist_header:-"X-Greylist: delayed %t seconds by postgrey-%v at %h\; %d"} -postgrey_pidfile=${postgrey_pidfile:-"/var/run/postgrey.pid"} -postgrey_flags=${postgrey_flags:-"--pidfile=${postgrey_pidfile} \ - --inet=10023 -d --user=%%USER%% --group=%%GROUP%% --dbdir=/var/db/postgrey \ - --x-greylist-header=${postgrey_greylist_header}"} - -pidfile="${postgrey_pidfile}" - run_rc_command "$1" >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305141933.r4EJXttX037182>