mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-02 01:20:54 +00:00
- Add LICENSE support (postgrey is under GPLv2).
- Make pkg-install, pkg-plist and the rc script use variables defined in the Makefile. - Start using our own ETCDIR instead of co-opting postfix. - Warn users about relocating the whitelists due to the ETCDIR move. - Set postgrey's default group (--group) to the port's value. - Add rc script postgrey_dbdir and postgrey_options variables to avoid duplication of defaults when adding command-line flags. - Remove redundant flags from the rc script postgrey_flags variable. PR: ports/162188 Submitted by: Darren Pilgrim <ports.maintainer@evilphi.com> (maintainer) Reviewed by: myself
This commit is contained in:
parent
aedaedf61c
commit
344323802b
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=285362
@ -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>
|
||||
|
@ -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
|
||||
|
||||
# Create home directory if required
|
||||
if [ -d "%%POSTGREYDIR%%" ]; then
|
||||
echo "---> Using existing Postgrey database directory (%%POSTGREYDIR%%)"
|
||||
echo " (There may be existing active postgrey databases - this installation"
|
||||
echo " will attempt to preserve them.)"
|
||||
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
|
||||
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
|
||||
;;
|
||||
# Create home directory if required
|
||||
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 (${DBDIR})"
|
||||
(umask 002 && mkdir -p ${DBDIR}) || exit 1
|
||||
chown -R ${USER}:${GROUP} ${DBDIR} || exit 1
|
||||
chmod g+s ${DBDIR} || exit 1
|
||||
fi
|
||||
|
||||
esac
|
||||
|
11
mail/postgrey/files/pkg-message.in
Normal file
11
mail/postgrey/files/pkg-message.in
Normal file
@ -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.
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user