aboutsummaryrefslogtreecommitdiff
path: root/mail/sqlgrey
diff options
context:
space:
mode:
authorMathieu Arnold <mat@FreeBSD.org>2005-02-18 11:39:31 +0000
committerMathieu Arnold <mat@FreeBSD.org>2005-02-18 11:39:31 +0000
commite317d86f7f150510ddad6e855b8c2808c54e8773 (patch)
treeb712f7978544b7affdb4d789bedc1eb5f251b9a0 /mail/sqlgrey
parent55f6ba0d5839b192c7ca106269f26ab2fe789f25 (diff)
downloadports-e317d86f7f150510ddad6e855b8c2808c54e8773.tar.gz
ports-e317d86f7f150510ddad6e855b8c2808c54e8773.zip
Notes
Diffstat (limited to 'mail/sqlgrey')
-rw-r--r--mail/sqlgrey/Makefile86
-rw-r--r--mail/sqlgrey/distinfo2
-rw-r--r--mail/sqlgrey/files/pkg-install.in61
-rw-r--r--mail/sqlgrey/files/sqlgrey.sh.in46
-rw-r--r--mail/sqlgrey/pkg-descr7
-rw-r--r--mail/sqlgrey/pkg-plist17
6 files changed, 219 insertions, 0 deletions
diff --git a/mail/sqlgrey/Makefile b/mail/sqlgrey/Makefile
new file mode 100644
index 000000000000..4b281262cf0b
--- /dev/null
+++ b/mail/sqlgrey/Makefile
@@ -0,0 +1,86 @@
+# New ports collection makefile for: sqlgrey
+# Date created: 17 Feb 2005
+# Whom: mat
+#
+# $FreeBSD$
+#
+
+PORTNAME= sqlgrey
+PORTVERSION= 1.4.5
+CATEGORIES= mail
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR= ${PORTNAME}
+
+MAINTAINER= mat@FreeBSD.org
+COMMENT= Greylisting policy server for Postfix using an SQL backend
+
+RUN_DEPENDS= ${SITE_PERL}/Net/Server.pm:${PORTSDIR}/net/p5-Net-Server \
+ ${SITE_PERL}/IO/Multiplex.pm:${PORTSDIR}/devel/p5-IO-Multiplex \
+ ${SITE_PERL}/Pod/Usage.pm:${PORTSDIR}/textproc/p5-PodParser
+
+.if defined(WITH_PGSQL)
+RUN_DEPENDS+= ${SITE_PERL}/${PERL_ARCH}/DBD/pg.pm:${PORTSDIR}/databases/p5-DBD-Pg
+.elif defined(WITH_MYSQL)
+RUN_DEPENDS+= ${SITE_PERL}/${PERL_ARCH}/DBD/mysql.pm:${PORTSDIR}/databases/p5-DBD-mysql
+.elif defined(WITH_SQLITE)
+RUN_DEPENDS+= ${SITE_PERL}/${PERL_ARCH}/DBD/SQLite.pm:${PORTSDIR}/databases/p5-DBD-SQLite
+.endif
+
+USE_PERL5_RUN= yes
+USE_RC_SUBR= sqlgrey.sh
+USE_BZIP2= yes
+NO_BUILD= yes
+USE_REINPLACE= yes
+
+ETCFILES= clients_fqdn_whitelist clients_ip_whitelist sqlgrey.conf
+SGY_USERNAME?= sqlgrey
+SGY_GROUPNAME?= ${SGY_USERNAME}
+ETCDIR?= etc/sqlgrey
+
+SUB_FILES= pkg-install
+SUB_LIST= ETCDIR=${ETCDIR} ETCFILES="${ETCFILES}" USER=${SGY_USERNAME} GROUP=${SGY_GROUPNAME}
+PLIST_SUB= ${SUB_LIST} TOUCH=${TOUCH}
+
+PKGINSTALL= ${WRKDIR}/pkg-install
+PKGDEINSTALL= ${PKGINSTALL}
+
+MAN1= sqlgrey.1
+
+.if !defined(NOPORTDOCS)
+PORTDOCS= Changelog FAQ HOWTO README TODO db_performance_reports
+.endif
+
+pre-everything::
+ @${ECHO_MSG} "You can choose which database to depend on by using"
+ @${ECHO_MSG} " WITH_PGSQL, WITH_MYSQL, or WITH_SQLITE"
+
+post-patch:
+ @${REINPLACE_CMD} -e 's!/etc/sqlgrey!${PREFIX}/${ETCDIR}!g' ${WRKSRC}/sqlgrey
+
+do-install:
+ @${INSTALL_SCRIPT} ${WRKSRC}/sqlgrey ${PREFIX}/sbin
+ @${INSTALL_SCRIPT} ${WRKSRC}/update_sqlgrey_whitelists ${PREFIX}/sbin
+ @${INSTALL_SCRIPT} ${WRKDIR}/sqlgrey.sh ${PREFIX}/etc/rc.d
+ @cd ${WRKSRC} && perldoc -u sqlgrey | pod2man sqlgrey > ${MANPREFIX}/man/man1/sqlgrey.1
+ @${MKDIR} ${PREFIX}/${ETCDIR}
+.for i in ${ETCFILES}
+ @${INSTALL_DATA} ${WRKSRC}/etc/${i} ${PREFIX}/${ETCDIR}/${i}.dist
+ @[ "${i}" = "sqlgrey.conf" ] || ${TOUCH} ${PREFIX}/${ETCDIR}/${i}.local
+ @[ -f ${PREFIX}/${ETCDIR}/${i} ] || ${INSTALL_DATA} ${WRKSRC}/etc/${i} ${PREFIX}/${ETCDIR}/${i}
+.if !defined(NOPORTDOCS)
+ @${MKDIR} ${DOCSDIR}
+ @${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${DOCSDIR}
+ @${ECHO_MSG} "===> Documentation installed in ${DOCSDIR}."
+.endif
+.endfor
+
+post-install:
+ @${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+
+.include <bsd.port.pre.mk>
+
+.if ${PERL_LEVEL} < 500600
+RUN_DEPENDS+= ${SITE_PERL}/Getopt/Long.pm:${PORTSDIR}/devel/p5-Getopt-Long
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/mail/sqlgrey/distinfo b/mail/sqlgrey/distinfo
new file mode 100644
index 000000000000..3798c436c643
--- /dev/null
+++ b/mail/sqlgrey/distinfo
@@ -0,0 +1,2 @@
+MD5 (sqlgrey-1.4.5.tar.bz2) = 677722d82c891d70e80006206420b069
+SIZE (sqlgrey-1.4.5.tar.bz2) = 30745
diff --git a/mail/sqlgrey/files/pkg-install.in b/mail/sqlgrey/files/pkg-install.in
new file mode 100644
index 000000000000..f3e8b1e5e87a
--- /dev/null
+++ b/mail/sqlgrey/files/pkg-install.in
@@ -0,0 +1,61 @@
+#! /bin/sh
+#
+# $FreeBSD$
+
+PATH=/bin:/usr/bin:/usr/sbin
+
+case $2 in
+
+ POST-INSTALL)
+
+ echo "---> Starting install script:"
+
+ if [ -z "%%USER%%" -o -z "%%GROUP%%" ]; then
+ echo "ERROR: A required pragma was empty"
+ exit 1
+ fi
+
+ # Create group if required
+ if /usr/sbin/pw group show "%%GROUP%%" >/dev/null 2>&1; then
+ echo "---> Using existing group \"%%GROUP%%\""
+ else
+ echo "---> Adding group \"%%GROUP%%\""
+ /usr/sbin/pw groupadd %%GROUP%% || exit 1
+ fi
+
+ # Create user if required
+ if /usr/sbin/pw user show "%%USER%%" >/dev/null 2>&1; then
+ echo "---> Using existing user \"%%USER%%\""
+ else
+ echo "---> Adding user \"%%USER%%\""
+ /usr/sbin/pw useradd "%%USER%%" -g "%%GROUP%%" -h - \
+ -d "%%DATADIR%%" -s "/sbin/nologin" -c "Postgrey Owner" || exit 1
+ fi
+
+ # Create home directory if required
+ if [ -d "%%DATADIR%%" ]; then
+ echo "---> Using existing Postgrey database directory (%%DATADIR%%)"
+ echo " (There may be existing active postgrey databases - this installation"
+ echo " will attempt to preserve them.)"
+ else
+ echo "---> Creating Postgrey database directory (%%DATADIR%%)"
+ (umask 002 && /bin/mkdir -p "%%DATADIR%%") || exit 1
+ /usr/sbin/chown -R "%%USER%%:%%GROUP%%" "%%DATADIR%%" || exit 1
+ /bin/chmod g+s "%%DATADIR%%" || exit 1
+ fi
+ ;;
+
+ POST-DEINSTALL)
+
+ echo "---> Please, remember to remove the user and the group with :"
+ if /usr/sbin/pw user show "%%USER%%" >/dev/null 2>&1; then
+ echo " /usr/sbin/pw userdel -n %%USER%%"
+ fi
+ if /usr/sbin/pw group show "%%GROUP%%" >/dev/null 2>&1; then
+ echo " /usr/sbin/pw groupdel -n %%GROUP%%"
+ fi
+ echo " as well as the databases."
+ echo " If you're only updating, you can leave the things as they are."
+ ;;
+
+esac
diff --git a/mail/sqlgrey/files/sqlgrey.sh.in b/mail/sqlgrey/files/sqlgrey.sh.in
new file mode 100644
index 000000000000..02f26b4ec524
--- /dev/null
+++ b/mail/sqlgrey/files/sqlgrey.sh.in
@@ -0,0 +1,46 @@
+#!/bin/sh
+# $FreeBSD$
+#
+
+# PROVIDE: sqlgrey
+# REQUIRE: LOGIN
+# BEFORE: mail
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable sqlgrey:
+#
+# sqlgrey_enable="YES"
+#
+# See man sqlgrey for flags or the config file.
+#
+
+. %%RC_SUBR%%
+
+name=sqlgrey
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/sbin/sqlgrey
+extra_commands=reload
+
+stop_postcmd=stop_postcmd
+
+stop_postcmd()
+{
+ rm -f $pidfile
+}
+
+# set defaults
+
+sqlgrey_enable=${sqlgrey_enable:-"NO"}
+sqlgrey_pidfile=${sqlgrey_pidfile:-"/var/run/sqlgrey.pid"}
+sqlgrey_listen=${sqlgrey_listen:-"2501"}
+sqlgrey_config=${sqlgrey_config:-"/usr/local/etc/sqlgrey.conf"}
+sqlgrey_flags=${sqlgrey_flags:-"--pidfile=${sqlgrey_pidfile} \
+ --inet=${sqlgrey_listen} --daemonize --user=sqlgrey --group=sqlgrey \
+ --configfile=${sqlgrey_config}"}
+
+pidfile="${sqlgrey_pidfile}"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/mail/sqlgrey/pkg-descr b/mail/sqlgrey/pkg-descr
new file mode 100644
index 000000000000..3dd01be78a1b
--- /dev/null
+++ b/mail/sqlgrey/pkg-descr
@@ -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/
diff --git a/mail/sqlgrey/pkg-plist b/mail/sqlgrey/pkg-plist
new file mode 100644
index 000000000000..edf9d64c49df
--- /dev/null
+++ b/mail/sqlgrey/pkg-plist
@@ -0,0 +1,17 @@
+@unexec if cmp -s %D/%%ETCDIR%%/clients_fqdn_whitelist.dist %D/%%ETCDIR%%/clients_fqdn_whitelist; then rm -f %D/%%ETCDIR%%/clients_fqdn_whitelist; fi
+@unexec [ -e %D/%%ETCDIR%%/clients_fqdn_whitelist.local -a ! -s %D/%%ETCDIR%%/clients_fqdn_whitelist.local ] && rm -f %D/%%ETCDIR%%/clients_fqdn_whitelist.local
+@unexec if cmp -s %D/%%ETCDIR%%/clients_ip_whitelist.dist %D/%%ETCDIR%%/clients_ip_whitelist; then rm -f %D/%%ETCDIR%%/clients_ip_whitelist; fi
+@unexec [ -e %D/%%ETCDIR%%/clients_ip_whitelist.local -a ! -s %D/%%ETCDIR%%/clients_ip_whitelist.local ] && rm -f %D/%%ETCDIR%%/clients_ip_whitelist.local
+@unexec if cmp -s %D/%%ETCDIR%%/sqlgrey.conf.dist %D/%%ETCDIR%%/sqlgrey.conf; then rm -f %D/%%ETCDIR%%/sqlgrey.conf; fi
+%%ETCDIR%%/clients_fqdn_whitelist.dist
+@exec [ -f %B/clients_fqdn_whitelist ] || cp %B/%f %B/clients_fqdn_whitelist
+@exec [ -f %B/clients_fqdn_whitelist.local ] || %%TOUCH%% %B/clients_fqdn_whitelist.local
+%%ETCDIR%%/clients_ip_whitelist.dist
+@exec [ -f %B/clients_ip_whitelist ] || cp %B/%f %B/clients_ip_whitelist
+@exec [ -f %B/clients_ip_whitelist.local ] || %%TOUCH%% %B/clients_ip_whitelist.local
+%%ETCDIR%%/sqlgrey.conf.dist
+@exec [ -f %B/sqlgrey.conf ] || cp %B/%f %B/sqlgrey.conf
+sbin/sqlgrey
+sbin/update_sqlgrey_whitelists
+@unexec rmdir %D/%%DATADIR%% 2>/dev/null || true
+@unexec rmdir %D/%%ETCDIR%% 2>/dev/null || true