Revive from the dead. This port is too important to let slip through the

cracks.

- Support STAGE
- Appease rclint and portlint
- Remove pkg-install. We can do this in @unexec and rc script.
- Set a default database option -- PGSQL will be default as recommended
upstream.
- Use new @sample capability
- SHEBANGFIX

Sponsored by:	SupraNet Communications, Inc
This commit is contained in:
Mark Felder
2014-09-03 20:49:19 +00:00
parent 66e15491db
commit 98a149bb83
6 changed files with 153 additions and 0 deletions

77
mail/sqlgrey/Makefile Normal file
View File

@@ -0,0 +1,77 @@
# Created by: mat
# $FreeBSD$
PORTNAME= sqlgrey
PORTVERSION= 1.8.0
PORTREVISION= 1
CATEGORIES= mail
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}-1.8%20%28stable%29
MAINTAINER= ports@FreeBSD.org
COMMENT= Greylisting policy server for Postfix using an SQL backend
LICENSE= GPLV2
RUN_DEPENDS= p5-Net-Server>=0:${PORTSDIR}/net/p5-Net-Server \
p5-IO-Multiplex>=0:${PORTSDIR}/devel/p5-IO-Multiplex \
p5-Pod-Parser>=0:${PORTSDIR}/textproc/p5-Pod-Parser
USES= perl5 shebangfix
SHEBANG_FILES= ${WRKSRC}/sqlgrey-logstats.pl ${WRKSRC}/update_sqlgrey_config ${WRKSRC}/sqlgrey
USE_PERL5= run
USE_RC_SUBR= sqlgrey
NO_BUILD= yes
ETCFILES= clients_fqdn_whitelist clients_ip_whitelist dyn_fqdn.regexp smtp_server.regexp sqlgrey.conf
USERS= sqlgrey
GROUPS= ${USERS}
ETCDIR?= etc/sqlgrey
SUB_LIST+= PERL=${PERL} USERS=${USERS} GROUPS=${GROUPS}
PLIST_SUB= TOUCH=${TOUCH}
OPTIONS_DEFINE= PGSQL MYSQL SQLITE STATS DOCS
OPTIONS_DEFAULT=PGSQL
STATS_DESC= Depend on Date::Calc for logstats.pl script
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MDOCS}
PORTDOCS= Changelog FAQ HOWTO README TODO
.endif
.if ${PORT_OPTIONS:MPGSQL}
RUN_DEPENDS+= p5-DBD-Pg>=0:${PORTSDIR}/databases/p5-DBD-Pg
.endif
.if ${PORT_OPTIONS:MMYSQL}
RUN_DEPENDS+= p5-DBD-mysql>=0:${PORTSDIR}/databases/p5-DBD-mysql
.endif
.if ${PORT_OPTIONS:MSQLITE}
RUN_DEPENDS+= p5-DBD-SQLite>=0:${PORTSDIR}/databases/p5-DBD-SQLite
.endif
.if ${PORT_OPTIONS:MSTATS}
RUN_DEPENDS+= p5-Date-Calc>=0:${PORTSDIR}/devel/p5-Date-Calc
.endif
post-patch:
@${REINPLACE_CMD} -e 's-#!/usr/bin/perl-#!${PERL}-' -e 's!/etc/sqlgrey!${PREFIX}/${ETCDIR}!g' ${WRKSRC}/sqlgrey
do-install:
@${INSTALL_SCRIPT} ${WRKSRC}/sqlgrey-logstats.pl ${STAGEDIR}/${PREFIX}/bin
@${INSTALL_SCRIPT} ${WRKSRC}/sqlgrey ${STAGEDIR}/${PREFIX}/sbin
@${INSTALL_SCRIPT} ${WRKSRC}/update_sqlgrey_config ${STAGEDIR}/${PREFIX}/sbin
@cd ${WRKSRC} && perldoc -u sqlgrey | pod2man sqlgrey > ${STAGEDIR}/${MANPREFIX}/man/man1/sqlgrey.1
@${MKDIR} ${STAGEDIR}/${PREFIX}/${ETCDIR}
.for i in ${ETCFILES}
@${INSTALL_DATA} ${WRKSRC}/etc/${i} ${STAGEDIR}/${PREFIX}/${ETCDIR}/${i}.sample
.endfor
.if ${PORT_OPTIONS:MDOCS}
@${MKDIR} ${STAGEDIR}/${DOCSDIR}
@${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${STAGEDIR}/${DOCSDIR}
@${ECHO_MSG} "===> Documentation installed in ${STAGEDIR}/${DOCSDIR}."
.endif
.include <bsd.port.mk>

2
mail/sqlgrey/distinfo Normal file
View File

@@ -0,0 +1,2 @@
SHA256 (sqlgrey-1.8.0.tar.gz) = 94e0fa191b30d672b748e934728ca73383bf9b36e4b17618b01adaaba40280e2
SIZE (sqlgrey-1.8.0.tar.gz) = 69476

View File

@@ -0,0 +1,11 @@
--- sqlgrey.orig 2013-09-27 06:51:40.913265753 -0500
+++ sqlgrey 2013-09-27 06:51:25.000000000 -0500
@@ -1037,7 +1037,7 @@
return join(":", (split(/:/, $addr))[0..3]);
} else {
## For Non-EUI64 or Non-Global-Unicast return the address
- return $addr;
+ return join(":", (split(/:/, $addr))[0..3]);
}
}

View File

@@ -0,0 +1,43 @@
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: sqlgrey
# REQUIRE: LOGIN
# BEFORE: mail
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable sqlgrey:
#
# sqlgrey_enable="YES"
#
# See man sqlgrey for flags or the config file.
. /etc/rc.subr
name=sqlgrey
rcvar=sqlgrey_enable
load_rc_config ${name}
command=%%PREFIX%%/sbin/sqlgrey
extra_commands=reload
command_interpreter=%%PERL%%
start_precmd=${name}_prestart
stop_postcmd="rm -f ${pidfile}"
sqlgrey_enable=${sqlgrey_enable-"NO"}
required_files=${sqlgrey_config-"%%PREFIX%%/%%ETCDIR%%/sqlgrey.conf"}
pidfile=${sqlgrey_pidfile-"/var/run/sqlgrey.pid"}
command_args="--configfile=${required_files} --pidfile=${pidfile} --daemonize"
sqlgrey_prestart()
{
if [ ! -d %%DATADIR%% ]; then
install -d -o %%USERS%% -g %%GROUPS%% -m 2775 %%DATADIR%%
fi
}
run_rc_command "$1"

7
mail/sqlgrey/pkg-descr Normal file
View File

@@ -0,0 +1,7 @@
SQLgrey is a postfix policy service implementing a grey-listing policy.
SQLgrey is written in Perl and uses DBI to access an SQL database.
Its goal is reducing the SPAM reaching user mailboxes
WWW: http://sqlgrey.sourceforge.net/

13
mail/sqlgrey/pkg-plist Normal file
View File

@@ -0,0 +1,13 @@
bin/sqlgrey-logstats.pl
@sample %%ETCDIR%%/clients_fqdn_whitelist.sample
@sample %%ETCDIR%%/clients_ip_whitelist.sample
@sample %%ETCDIR%%/dyn_fqdn.regexp.sample
@sample %%ETCDIR%%/smtp_server.regexp.sample
@sample %%ETCDIR%%/sqlgrey.conf.sample
man/man1/sqlgrey.1.gz
sbin/sqlgrey
sbin/update_sqlgrey_config
@dirrmtry %%ETCDIR%%
@unexec echo "---> Please, remember to remove the database directory:"
@unexec echo " %%DATADIR%%"
@unexec echo " If you're only updating, you can leave the things as they are."