pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mail/qmail-run Add dependency on qmail-qfilter. Deprec...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0fc6d156d44e
branches:  trunk
changeset: 363047:0fc6d156d44e
user:      schmonz <schmonz%pkgsrc.org@localhost>
date:      Wed May 31 07:08:04 2017 +0000

description:
Add dependency on qmail-qfilter. Deprecate qmail-qfilter-queue in favor
of qmail-qfilter-{ofmipd,smtpd}-queue, and document how to enable
filtering for incoming and submitted messages. Bump version.

diffstat:

 mail/qmail-run/MESSAGE                      |  19 ++++++-
 mail/qmail-run/Makefile                     |  20 ++++---
 mail/qmail-run/PLIST                        |   4 +-
 mail/qmail-run/files/qmail-qfilter-queue.sh |  74 ++++++++++++++++++++--------
 4 files changed, 83 insertions(+), 34 deletions(-)

diffs (192 lines):

diff -r dafee9419b8c -r 0fc6d156d44e mail/qmail-run/MESSAGE
--- a/mail/qmail-run/MESSAGE    Wed May 31 06:30:25 2017 +0000
+++ b/mail/qmail-run/MESSAGE    Wed May 31 07:08:04 2017 +0000
@@ -1,8 +1,11 @@
 ===========================================================================
-$NetBSD: MESSAGE,v 1.4 2017/01/09 04:58:09 schmonz Exp $
+$NetBSD: MESSAGE,v 1.5 2017/05/31 07:08:04 schmonz Exp $
 
 Please read ${PREFIX}/share/doc/qmail-run/README.pkgsrc.
 
+NOTE: qmail-qfilter-queue is deprecated and will be removed in 2017Q3.
+Please migrate to qmail-qfilter-{ofmipd,smtpd}-queue.
+
 To enable qmail for...
 
 Local and outgoing deliveries:
@@ -24,8 +27,20 @@
 POP3 (only for Maildirs):
 - Set qmailpop3d=YES in /etc/rc.conf.
 
-To make the queue visible to local non-root users:
+Local non-root users to see the queue:
 - Set qmailqread=YES in /etc/rc.conf.
 - Change the mailq entry in /etc/mailer.conf to qmail-qread-client.
 
+Filtering incoming messages arriving via SMTP:
+- Set QMAILQUEUE="${PREFIX}/bin/qmail-qfilter-smtpd-queue" in tcp.smtp.
+- Reload the cdb: /etc/rc.d/qmailsmtpd cdb
+- Consult qmail-qfilter(1) and see share/examples/qmail-qfilter.
+- Place executable filters named 'smtpd-*' in ${PKG_SYSCONFDIR}/filters.
+
+Filtering outgoing messages submitted via OFMIP:
+- Set QMAILQUEUE="${PREFIX}/bin/qmail-qfilter-ofmipd-queue" in tcp.ofmip.
+- Reload the cdb: /etc/rc.d/qmailofmipd cdb
+- Consult qmail-qfilter(1) and see share/examples/qmail-qfilter.
+- Place executable filters named 'ofmipd-*' in ${PKG_SYSCONFDIR}/filters.
+
 ===========================================================================
diff -r dafee9419b8c -r 0fc6d156d44e mail/qmail-run/Makefile
--- a/mail/qmail-run/Makefile   Wed May 31 06:30:25 2017 +0000
+++ b/mail/qmail-run/Makefile   Wed May 31 07:08:04 2017 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.35 2017/04/11 14:04:37 schmonz Exp $
+# $NetBSD: Makefile,v 1.36 2017/05/31 07:08:04 schmonz Exp $
 #
 
-DISTNAME=              qmail-run-20170411
+DISTNAME=              qmail-run-20170531
 CATEGORIES=            mail
 MASTER_SITES=          # empty
 DISTFILES=             # empty
@@ -12,8 +12,7 @@
 
 DEPENDS_QMAIL=         qmail>=1.03nb8:../../mail/qmail
 DEPENDS+=              ${DEPENDS_QMAIL}
-
-CONFLICTS+=            qmail-qfilter-1.5nb1
+DEPENDS+=              qmail-qfilter>1.5nb1:../../mail/qmail-qfilter
 
 WRKSRC=                        ${WRKDIR}
 NO_BUILD=              yes
@@ -24,12 +23,12 @@
 FILES_SUBST+=          QMAIL_SEND_USER=${QMAIL_SEND_USER:Q}
 FILES_SUBST+=          QMAIL_QUEUE_EXTRA=${QMAIL_QUEUE_EXTRA:Q}
 FILES_SUBST+=          PKGNAME=${PKGNAME:Q}
-MESSAGE_SUBST+=                PKG_SYSCONFBASE=${PKG_SYSCONFBASE}
+MESSAGE_SUBST+=                PKG_SYSCONFBASE=${PKG_SYSCONFBASE:Q}
 RCD_SCRIPTS=           qmail qmailofmipd qmailpop3d qmailqread qmailsend qmailsmtpd
 
 INSTALLATION_DIRS=     bin share/doc/qmail-run share/examples/qmail-run
 BUILD_DEFS+=           QMAIL_DAEMON_USER QMAIL_LOG_USER QMAIL_SEND_USER
-BUILD_DEFS+=           QMAIL_QUEUE_EXTRA
+BUILD_DEFS+=           QMAIL_QUEUE_EXTRA PKG_SYSCONFBASE
 
 .include "../../mk/bsd.prefs.mk"
 
@@ -71,9 +70,12 @@
        done
 
 do-install:
-       ${INSTALL_SCRIPT} ${WRKDIR}/qmail-procmail ${DESTDIR}${PREFIX}/bin
-       ${INSTALL_SCRIPT} ${WRKDIR}/qmail-qfilter-queue ${DESTDIR}${PREFIX}/bin
-       ${INSTALL_SCRIPT} ${WRKDIR}/qmail-qread-client ${DESTDIR}${PREFIX}/bin
+       for f in qmail-procmail qmail-qfilter-queue qmail-qread-client; do \
+           ${INSTALL_SCRIPT} ${WRKDIR}/$$f ${DESTDIR}${PREFIX}/bin;    \
+       done
+       for f in qmail-qfilter-ofmipd-queue qmail-qfilter-smtpd-queue; do \
+           ${INSTALL_SCRIPT} ${WRKDIR}/qmail-qfilter-queue ${DESTDIR}${PREFIX}/bin/$$f;        \
+       done
        ${INSTALL_DATA} ${WRKDIR}/README.pkgsrc \
                ${DESTDIR}${PREFIX}/share/doc/qmail-run
        ${INSTALL_DATA} ${WRKDIR}/mailer.conf \
diff -r dafee9419b8c -r 0fc6d156d44e mail/qmail-run/PLIST
--- a/mail/qmail-run/PLIST      Wed May 31 06:30:25 2017 +0000
+++ b/mail/qmail-run/PLIST      Wed May 31 07:08:04 2017 +0000
@@ -1,6 +1,8 @@
-@comment $NetBSD: PLIST,v 1.7 2017/01/09 04:58:09 schmonz Exp $
+@comment $NetBSD: PLIST,v 1.8 2017/05/31 07:08:04 schmonz Exp $
 bin/qmail-procmail
+bin/qmail-qfilter-ofmipd-queue
 bin/qmail-qfilter-queue
+bin/qmail-qfilter-smtpd-queue
 bin/qmail-qread-client
 share/doc/qmail-run/README.pkgsrc
 share/examples/qmail-run/mailer.conf
diff -r dafee9419b8c -r 0fc6d156d44e mail/qmail-run/files/qmail-qfilter-queue.sh
--- a/mail/qmail-run/files/qmail-qfilter-queue.sh       Wed May 31 06:30:25 2017 +0000
+++ b/mail/qmail-run/files/qmail-qfilter-queue.sh       Wed May 31 07:08:04 2017 +0000
@@ -5,31 +5,61 @@
 #
 # Using this wrapper, executable filters:
 # * Must be placed in @PKG_SYSCONFDIR@/filters
-# * Must have filenames matching "qfilter-*"
+# * Must have filenames matching "ofmipd-*" or "smtpd-*"
 # * Will be executed with no arguments
 # * Will be executed in sort(1) order
-#
-# To use this script to filter messages arriving via SMTP, set the
-# QMAILQUEUE environment variable in tcp.smtp like so:
-#
-# :allow,QMAILQUEUE="@PREFIX@/bin/qmail-qfilter-queue"
-#
-# Then rebuild the cdb.
+
+CAT=@CAT@
+ECHO=@ECHO@
+PKG_SYSCONFDIR=@PKG_SYSCONFDIR@
+PREFIX=@PREFIX@
+SED=@SED@
+SORT=@SORT@
 
-possible_qfilters=`@ECHO@ @PKG_SYSCONFDIR@/filters/qfilter-* | @SORT@`
-qfilters=""
+warn() {
+       ${ECHO} >&2 "$@"
+}
+
+choose_glob() {
+       local _progname _glob
+       _progname="$1"
+       case "${_progname}" in
+       qmail-qfilter-ofmipd-queue)     _glob='ofmipd-*'        ;;
+       qmail-qfilter-smtpd-queue)      _glob='smtpd-*'         ;;
+       qmail-qfilter-queue)            _glob='qfilter-*'       ;;
+       esac
+       ${ECHO} "${_glob}"
+}
 
-if [ "${possible_qfilters}" = "@PKG_SYSCONFDIR@/filters/qfilter-*" ]; then
-       qfilters="@CAT@"
-else
-       for qfilter in ${possible_qfilters}; do
-               if [ -x "${qfilter}" ]; then
-                       qfilters="${qfilters} ${qfilter}"
-               fi
-       done
-       [ -z "${qfilters}" ] && qfilters="@CAT@"
-fi
+choose_filters() {
+       local _glob _filters _possible_filters _filter
+       _glob="$1"
+       _possible_filters=$(${ECHO} ${PKG_SYSCONFDIR}/filters/${_glob} | ${SORT})
+       if [ "${_possible_filters}" = "${PKG_SYSCONFDIR}/filters/${_glob}" ]; then
+               _filters="${CAT}"
+       else
+               for _filter in ${_possible_filters}; do
+                       [ -x "${_filter}" ] && _filters="${_filters} ${_filter}"
+               done
+               [ -z "${_filters}" ] && _filters="${CAT}"
+       fi
+       ${ECHO} "${_filters}"
+}
 
-qfilter_cmd="@PREFIX@/bin/qmail-qfilter `@ECHO@ ${qfilters} | @SED@ -e 's| | -- |g'`"
+qfilter_args() {
+       local _filters
+       _filters="$1"
+       ${ECHO} ${_filters} | ${SED} -e 's| | -- |g'
+}
 
-exec ${qfilter_cmd}
+main() {
+       local _progname _glob _filters _args _cmd
+       _progname=$(basename "$0")
+       _glob=$(choose_glob "${_progname}")
+       _filters=$(choose_filters "${_glob}")
+       _args=$(qfilter_args "${_filters}")
+       _cmd="${PREFIX}/bin/qmail-qfilter ${_args}"
+       exec ${_cmd}
+}
+
+main "$@"



Home | Main Index | Thread Index | Old Index