diff options
author | Martin Matuska <mm@FreeBSD.org> | 2011-11-09 09:15:33 +0000 |
---|---|---|
committer | Martin Matuska <mm@FreeBSD.org> | 2011-11-09 09:15:33 +0000 |
commit | 344323802b8bc6e84aba50d13c2d3ac216141530 (patch) | |
tree | 972cd0e39d6e7d54a1070cb27792c8b65c439b24 /mail | |
parent | aedaedf61cd6d6bce27527fb5390c67899be0674 (diff) | |
download | ports-344323802b8bc6e84aba50d13c2d3ac216141530.tar.gz ports-344323802b8bc6e84aba50d13c2d3ac216141530.zip |
Notes
Diffstat (limited to 'mail')
-rw-r--r-- | mail/postgrey/Makefile | 41 | ||||
-rw-r--r-- | mail/postgrey/files/pkg-install.in | 48 | ||||
-rw-r--r-- | mail/postgrey/files/pkg-message.in | 11 | ||||
-rw-r--r-- | mail/postgrey/files/postgrey.in | 14 | ||||
-rw-r--r-- | mail/postgrey/pkg-plist | 14 |
5 files changed, 66 insertions, 62 deletions
diff --git a/mail/postgrey/Makefile b/mail/postgrey/Makefile index ad2488c804be..18bd6a8564fa 100644 --- a/mail/postgrey/Makefile +++ b/mail/postgrey/Makefile @@ -7,6 +7,7 @@ PORTNAME= postgrey PORTVERSION= 1.34 +PORTREVISION= 1 CATEGORIES= mail MASTER_SITES= http://postgrey.schweikert.ch/pub/ \ http://postgrey.schweikert.ch/pub/old/ @@ -14,6 +15,9 @@ MASTER_SITES= http://postgrey.schweikert.ch/pub/ \ MAINTAINER= ports.maintainer@evilphi.com COMMENT= Greylisting policy server for Postfix +LICENSE= GPLv2 +LICENSE_FILE= ${WRKSRC}/COPYING + RUN_DEPENDS= ${SITE_PERL}/Net/Server.pm:${PORTSDIR}/net/p5-Net-Server \ ${SITE_PERL}/IO/Multiplex.pm:${PORTSDIR}/devel/p5-IO-Multiplex \ ${SITE_PERL}/Parse/Syslog.pm:${PORTSDIR}/textproc/p5-Parse-Syslog \ @@ -25,37 +29,35 @@ USE_RC_SUBR= ${PORTNAME} NO_BUILD= yes 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}" \ - POSTGREYDIR=${PGY_DIR} -ETCFILES= whitelist_clients whitelist_recipients -PGY_USERNAME?= postgrey -PGY_USERID?= 225 -PGY_GROUPNAME?= ${PGY_USERNAME} -PGY_GROUPID?= ${PGY_USERID} -PGY_DIR?= /var/db/postgrey - -USERS= ${PGY_USERNAME} -GROUPS= ${PGY_GROUPNAME} MAN1= ${PORTNAME}.1 policy-test.1 postgreyreport.1 +PGY_DBDIR= /var/db/postgrey + +USERS?= postgrey +GROUPS?= postgrey + +PLIST_SUB= DBDIR=${PGY_DBDIR} + +SUB_FILES= ${PORTNAME} pkg-install pkg-message +SUB_LIST= USER=${USERS} GROUP=${GROUPS} DBDIR=${PGY_DBDIR} + post-patch: @${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 + @${REINPLACE_CMD} -e 's#/etc/postfix#${ETCDIR}#' ${WRKSRC}/postgrey ${WRKSRC}/postgrey_whitelist_* + @${REINPLACE_CMD} -e 's#/var/spool/postfix/postgrey#${PGY_DBDIR}#' ${WRKSRC}/postgrey ${WRKSRC}/contrib/postgreyreport + @${REINPLACE_CMD} -e 's#nogroup#${GROUPS}#' ${WRKSRC}/postgrey do-install: - @${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL @${POD2MAN} ${WRKSRC}/${PORTNAME} ${WRKSRC}/${PORTNAME}.1 @${POD2MAN} ${WRKSRC}/policy-test ${WRKSRC}/policy-test.1 @${POD2MAN} ${WRKSRC}/contrib/postgreyreport ${WRKSRC}/postgreyreport.1 @${INSTALL_SCRIPT} ${WRKSRC}/postgrey ${PREFIX}/sbin @${INSTALL_SCRIPT} ${WRKSRC}/policy-test ${PREFIX}/sbin @${INSTALL_SCRIPT} ${WRKSRC}/contrib/postgreyreport ${PREFIX}/sbin - @${INSTALL} -d ${PREFIX}/etc/postfix -.for i in ${ETCFILES} - ${INSTALL_DATA} ${WRKSRC}/postgrey_${i} ${PREFIX}/etc/postfix/dist-postgrey_${i} + @${INSTALL} -d ${ETCDIR} +.for file in postgrey_whitelist_clients postgrey_whitelist_recipients + ${INSTALL_DATA} ${WRKSRC}/${file} ${ETCDIR}/dist-${file} + @${CP} -n ${ETCDIR}/dist-${file} ${ETCDIR}/${file} .endfor .if !defined(NOPORTDOCS) @@ -66,5 +68,6 @@ do-install: post-install: @${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL + @${CAT} ${PKGMESSAGE} .include <bsd.port.mk> diff --git a/mail/postgrey/files/pkg-install.in b/mail/postgrey/files/pkg-install.in index 1274432e89cd..cd75eb295bc0 100644 --- a/mail/postgrey/files/pkg-install.in +++ b/mail/postgrey/files/pkg-install.in @@ -1,46 +1,32 @@ #! /bin/sh # -# $FreeBSD: /tmp/pcvs/ports/mail/postgrey/files/pkg-install.in,v 1.3 2011-10-20 21:12:06 crees Exp $ +# $FreeBSD: /tmp/pcvs/ports/mail/postgrey/files/pkg-install.in,v 1.4 2011-11-09 09:15:33 mm Exp $ PATH=/bin:/usr/bin:/usr/sbin +DBDIR="%%DBDIR%%" +USER="%%USER%%" +GROUP="%%GROUP%%" 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 - echo "ERROR: A required pragma was empty" - exit 1 - fi +POST-INSTALL) + echo "---> Starting post-install script:" # Create home directory if required - if [ -d "%%POSTGREYDIR%%" ]; then - echo "---> Using existing Postgrey database directory (%%POSTGREYDIR%%)" + if [ -z ${DBDIR} ]; then + echo "---> Default database directory not specified" + elif [ -d ${DBDIR} ]; then + echo "---> Using existing Postgrey database directory (${DBDIR})" echo " (There may be existing active postgrey databases - this installation" echo " will attempt to preserve them.)" + elif [ -e ${DBDIR} ]; then + echo "---> The default Postgrey database directory (${DBDIR})" + echo " exists but is not a directory - you have to create it yourself" else - echo "---> Creating Postgrey database directory (%%POSTGREYDIR%%)" - (umask 002 && /bin/mkdir -p "%%POSTGREYDIR%%") || exit 1 - /usr/sbin/chown -R "%%USER%%:%%GROUP%%" "%%POSTGREYDIR%%" || exit 1 - /bin/chmod g+s "%%POSTGREYDIR%%" || exit 1 + echo "---> Creating Postgrey database directory (${DBDIR})" + (umask 002 && mkdir -p ${DBDIR}) || exit 1 + chown -R ${USER}:${GROUP} ${DBDIR} || exit 1 + chmod g+s ${DBDIR} || exit 1 fi - ;; - -POST-INSTALL) - echo "---> Starting post-install script:" - - for i in %%ETCFILES%%; do - if [ ! -f "%%PREFIX%%/etc/postfix/postgrey_${i}" ]; then - echo "---> Installing new config file %%PREFIX%%/etc/postfix/postgrey_${i}" - cp -p %%PREFIX%%/etc/postfix/dist-postgrey_${i} \ - %%PREFIX%%/etc/postfix/postgrey_${i} - else - echo "---> Keeping existing config file %%PREFIX%%/etc/postfix/postgrey_${i}" - fi - done - ;; esac diff --git a/mail/postgrey/files/pkg-message.in b/mail/postgrey/files/pkg-message.in new file mode 100644 index 000000000000..f242a7062411 --- /dev/null +++ b/mail/postgrey/files/pkg-message.in @@ -0,0 +1,11 @@ + + +ATTENTION: + +The default location of the whitelist files has changed from +%%PREFIX%%/etc/postfix to %%ETCDIR%%. If you modified the +whitelists, you will need to either move them to the new location or +specify their location by adding --whitelist-clients and +--whitelist-recipients parameters to postgrey_options in /etc/rc.conf. + + diff --git a/mail/postgrey/files/postgrey.in b/mail/postgrey/files/postgrey.in index c8b25560a99e..0c32135b8c89 100644 --- a/mail/postgrey/files/postgrey.in +++ b/mail/postgrey/files/postgrey.in @@ -12,7 +12,9 @@ # # postgrey_enable="YES" # -# See perldoc postgrey for flags +# See perldoc postgrey or run `postgrey --help` to see options. You can change +# the --dbdir path by setting postgrey_dbdir. Specify additional options with +# the postgrey_options variable. # . /etc/rc.subr @@ -21,7 +23,6 @@ name=postgrey rcvar=`set_rcvar` command=%%PREFIX%%/sbin/postgrey -required_dirs=/var/db/postgrey extra_commands=reload stop_postcmd=stop_postcmd @@ -35,13 +36,14 @@ stop_postcmd() load_rc_config $name +postgrey_dbdir=${postgrey_dbdir:-"%%DBDIR%%"} postgrey_enable=${postgrey_enable:-"NO"} -postgrey_greylist_header=${postgrey_greylist_header:-"X-Greylist: delayed %t seconds by postgrey-%v at %h\; %d"} +postgrey_options=${postgrey_options:-"--inet:10023"} 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}"} +postgrey_flags=${postgrey_flags:-"-d --pidfile=${postgrey_pidfile} \ + --dbdir=${postgrey_dbdir} ${postgrey_options}"} pidfile="${postgrey_pidfile}" +required_dirs=${postgrey_dbdir} run_rc_command "$1" diff --git a/mail/postgrey/pkg-plist b/mail/postgrey/pkg-plist index 6bb75d12dfc9..73c0386a176c 100644 --- a/mail/postgrey/pkg-plist +++ b/mail/postgrey/pkg-plist @@ -1,9 +1,11 @@ -@unexec if cmp -s %D/etc/postfix/dist-postgrey_whitelist_recipients %D/etc/postfix/postgrey_whitelist_recipients; then rm -f %D/etc/postfix/postgrey_whitelist_recipients; fi -@unexec if cmp -s %D/etc/postfix/dist-postgrey_whitelist_clients %D/etc/postfix/postgrey_whitelist_clients; then rm -f %D/etc/postfix/postgrey_whitelist_clients; fi +@unexec if cmp -s %D/%%ETCDIR%%/dist-postgrey_whitelist_recipients %D/%%ETCDIR%%/postgrey_whitelist_recipients; then rm %D/%%ETCDIR%%/postgrey_whitelist_recipients; fi +@unexec if cmp -s %D/%%ETCDIR%%/dist-postgrey_whitelist_clients %D/%%ETCDIR%%/postgrey_whitelist_clients; then rm %D/%%ETCDIR%%/postgrey_whitelist_clients; fi sbin/postgrey sbin/policy-test sbin/postgreyreport -etc/postfix/dist-postgrey_whitelist_recipients -etc/postfix/dist-postgrey_whitelist_clients -@dirrmtry etc/postfix -@unexec rmdir /var/db/postgrey 2>/dev/null || true +%%ETCDIR%%/dist-postgrey_whitelist_recipients +@exec [ ! -f %B/postgrey_whitelist_recipients ] && cp %B/%f %B/postgrey_whitelist_recipients +%%ETCDIR%%/dist-postgrey_whitelist_clients +@exec [ ! -f %B/postgrey_whitelist_clients ] && cp %B/%f %B/postgrey_whitelist_clients +@dirrmtry %%ETCDIR%% +@unexec rmdir %%DBDIR%% 2>/dev/null || true |