pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mail/qmail-run Replace dependency on "qmail or netqmai...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4f70065cf3a8
branches:  trunk
changeset: 479813:4f70065cf3a8
user:      schmonz <schmonz%pkgsrc.org@localhost>
date:      Mon Aug 23 03:47:48 2004 +0000

description:
Replace dependency on "qmail or netqmail" with dependency on qmail.

Remove dependency on mailwrapper. If you're on a Linux with
/etc/alternatives, for instance, you don't need it. For platforms
where mailwrapper builds and provides functionality not otherwise
available, it's still a good idea.

Remove dependency on rc.subr. Teach the rc.d scripts to start
services even in the absence of rc.subr. For full rc.d-style
functionality, rc.subr is still required.

Create control/concurrencypop3 at install time, and use it in the
qmailpop3d rc.d script. From Dave Sill's book.

Add comments to the qmail rc.d script to satisfy Linux's chkconfig
utility. From the qmailctl script in "Life with qmail".

Add qmail-procmail wrapper script to map procmail's exit codes to
qmail's. To use procmail, install it and call this script. From
Dave Sill's book.

Add qmail-qfilter-queue wrapper script. Previously part of the
qmail-qfilter package, it's moving here for the same reasons that
all my other custom scripts moved here.

Insert a blank comment line in pkgsrc-generated config files.

Bump version.

diffstat:

 mail/qmail-run/DESCR                        |   1 +
 mail/qmail-run/INSTALL                      |  17 +++++++++----
 mail/qmail-run/MESSAGE                      |   4 +-
 mail/qmail-run/Makefile                     |  31 ++++++++++--------------
 mail/qmail-run/PLIST                        |   4 ++-
 mail/qmail-run/files/qmail-procmail.sh      |  13 ++++++++++
 mail/qmail-run/files/qmail-qfilter-queue.sh |  35 +++++++++++++++++++++++++++++
 mail/qmail-run/files/qmail.sh               |   7 ++++-
 mail/qmail-run/files/qmailpop3d.sh          |  20 ++++++++++++----
 mail/qmail-run/files/qmailqread.sh          |  16 +++++++++---
 mail/qmail-run/files/qmailsend.sh           |  16 +++++++++---
 mail/qmail-run/files/qmailsmtpd.sh          |  16 +++++++++---
 12 files changed, 135 insertions(+), 45 deletions(-)

diffs (truncated from 404 to 300 lines):

diff -r e53f152a0e7e -r 4f70065cf3a8 mail/qmail-run/DESCR
--- a/mail/qmail-run/DESCR      Mon Aug 23 03:44:34 2004 +0000
+++ b/mail/qmail-run/DESCR      Mon Aug 23 03:47:48 2004 +0000
@@ -1,2 +1,3 @@
 This package creates all the needed basic config files to run qmail,
 and provides NetBSD-style rc.d scripts and an example mailer.conf.
+It also includes wrapper scripts for procmail and qmail-qfilter.
diff -r e53f152a0e7e -r 4f70065cf3a8 mail/qmail-run/INSTALL
--- a/mail/qmail-run/INSTALL    Mon Aug 23 03:44:34 2004 +0000
+++ b/mail/qmail-run/INSTALL    Mon Aug 23 03:47:48 2004 +0000
@@ -1,6 +1,7 @@
 QMAIL_QUEUE_EXTRA=@QMAIL_QUEUE_EXTRA@
 
-psmsg='# This file was auto-generated by pkgsrc.'
+psmsg='#
+# This file was auto-generated by pkgsrc.'
 
 case ${STAGE} in
 
@@ -9,15 +10,21 @@
 
        cd ${PKG_SYSCONFDIR}/alias && ${TOUCH} .qmail-postmaster .qmail-mailer-daemon .qmail-root
 
+       if ! [ -s ${PKG_SYSCONFDIR}/control/concurrencypop3 ]; then
+               ${ECHO} 20 > ${PKG_SYSCONFDIR}/control/concurrencypop3
+               ${ECHO} "$psmsg" >> ${PKG_SYSCONFDIR}/control/concurrencypop3
+               ${CHMOD} 644 ${PKG_SYSCONFDIR}/control/concurrencypop3
+       fi
+
        if ! [ -s ${PKG_SYSCONFDIR}/control/concurrencyincoming ]; then
                ${ECHO} 20 > ${PKG_SYSCONFDIR}/control/concurrencyincoming
-               ${ECHO} $psmsg >> ${PKG_SYSCONFDIR}/control/concurrencyincoming
+               ${ECHO} "$psmsg" >> ${PKG_SYSCONFDIR}/control/concurrencyincoming
                ${CHMOD} 644 ${PKG_SYSCONFDIR}/control/concurrencyincoming
        fi
 
        if ! [ -s ${PKG_SYSCONFDIR}/control/defaultdelivery ]; then
                ${ECHO} ./Mailbox > ${PKG_SYSCONFDIR}/control/defaultdelivery
-               ${ECHO} $psmsg >> ${PKG_SYSCONFDIR}/control/defaultdelivery
+               ${ECHO} "$psmsg" >> ${PKG_SYSCONFDIR}/control/defaultdelivery
                ${CHMOD} 644 ${PKG_SYSCONFDIR}/control/defaultdelivery
        fi
 
@@ -25,7 +32,7 @@
        smtprule='127.:allow,RELAYCLIENT=""'
        for i in pop3 smtp; do
                if ! [ -s ${PKG_SYSCONFDIR}/tcp.${i} ]; then
-                       ${ECHO} $psmsg > ${PKG_SYSCONFDIR}/tcp.${i}
+                       ${ECHO} "$psmsg" > ${PKG_SYSCONFDIR}/tcp.${i}
                        eval ${ECHO} \"\$${i}rule\" > ${PKG_SYSCONFDIR}/tcp.${i}
                fi
                ${CHMOD} 644 ${PKG_SYSCONFDIR}/tcp.${i}
@@ -34,7 +41,7 @@
        done
 
        if ! [ -z ${QMAIL_QUEUE_EXTRA} ]; then
-               ${ECHO} $psmsg >> ${PKG_SYSCONFDIR}/alias/.qmail-${QMAIL_QUEUE_EXTRA}
+               ${ECHO} "$psmsg" >> ${PKG_SYSCONFDIR}/alias/.qmail-${QMAIL_QUEUE_EXTRA}
                ${CHMOD} 644 ${PKG_SYSCONFDIR}/alias/.qmail-${QMAIL_QUEUE_EXTRA}
        fi
 
diff -r e53f152a0e7e -r 4f70065cf3a8 mail/qmail-run/MESSAGE
--- a/mail/qmail-run/MESSAGE    Mon Aug 23 03:44:34 2004 +0000
+++ b/mail/qmail-run/MESSAGE    Mon Aug 23 03:47:48 2004 +0000
@@ -1,5 +1,5 @@
 ===========================================================================
-$NetBSD: MESSAGE,v 1.2 2004/08/02 17:28:30 schmonz Exp $
+$NetBSD: MESSAGE,v 1.3 2004/08/23 03:47:48 schmonz Exp $
 
 Please read ${PREFIX}/share/doc/qmail-run/README.pkgsrc.
 
@@ -16,7 +16,7 @@
 POP3 (only for Maildirs):
 - Set qmailpop3d=YES in /etc/rc.conf.
 
-Make the queue visible to local non-root users:
+To make the queue visible to local non-root users:
 - Set qmailqread=YES in /etc/rc.conf.
 - Change the mailq entry in /etc/mailer.conf to qmail-qread-client.
 
diff -r e53f152a0e7e -r 4f70065cf3a8 mail/qmail-run/Makefile
--- a/mail/qmail-run/Makefile   Mon Aug 23 03:44:34 2004 +0000
+++ b/mail/qmail-run/Makefile   Mon Aug 23 03:47:48 2004 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.2 2004/08/03 08:59:24 schmonz Exp $
+# $NetBSD: Makefile,v 1.3 2004/08/23 03:47:48 schmonz Exp $
 #
 
-DISTNAME=              qmail-run-20040803
+DISTNAME=              qmail-run-20040823
 CATEGORIES=            mail
 MASTER_SITES=          # empty
 DISTFILES=             # empty
@@ -9,14 +9,8 @@
 MAINTAINER=            schmonz%NetBSD.org@localhost
 COMMENT=               Configures qmail to receive and deliver mail
 
-DEPENDS_QMAIL=         {qmail>=1.03nb8,netqmail>=1.05nb1}:../../mail/qmail
+DEPENDS_QMAIL=         qmail>=1.03nb8:../../mail/qmail
 DEPENDS+=              ${DEPENDS_QMAIL}
-.if !exists(/usr/sbin/mailwrapper)
-DEPENDS+=              mailwrapper-[0-9]*:../../mail/mailwrapper
-.endif
-.if !exists(/etc/rc.subr)
-DEPENDS+=              rc.subr-[0-9]*:../../pkgtools/rc.subr
-.endif
 
 PKG_INSTALLATION_TYPES=        overwrite pkgviews
 
@@ -27,21 +21,16 @@
 INSTALL_EXTRA_TMPL+=   ${.CURDIR}/INSTALL
 FILES_SUBST+=          QMAIL_QUEUE_EXTRA=${QMAIL_QUEUE_EXTRA}
 FILES_SUBST+=          PKGNAME=${PKGNAME}
-RCD_SCRIPTS=           qmail qmailqread qmailpop3d qmailsend qmailsmtpd
+RCD_SCRIPTS=           qmail qmailpop3d qmailqread qmailsend qmailsmtpd
 
 INSTALLATION_DIRS=     bin share/doc/qmail-run share/examples/qmail-run
 
 .include "../../mk/bsd.prefs.mk"
 
-# Detect the PKG_SYSCONFDIR of the installed qmail or netqmail, so we
-# can create config files there and refer to them from rc.d scripts.
+# Detect the PKG_SYSCONFDIR of the installed qmail, so we can create
+# config files there and refer to them from rc.d scripts.
 .if !empty(PHASES_AFTER_EXTRACT:M${PKG_PHASE})
-INSTALLED_QMAIL!= \
-       dep=`${PKG_BEST_EXISTS} ${DEPENDS_QMAIL:C/:.*$//:Q:S/\ / /g}`;  \
-       case "$$dep" in                                                 \
-       "")     ${ECHO} "qmail_not_found_" ;;                           \
-       *)      ${ECHO} "$$dep" ;;                                      \
-       esac
+INSTALLED_QMAIL!= ${PKG_BEST_EXISTS} ${DEPENDS_QMAIL:C/:.*$//:Q:S/\ / /g}
 .  if empty(INSTALLED_QMAIL:M*_not_found_)
 .    if !defined(PKG_SYSCONFDIR.qmail-run)
 PKG_SYSCONFDIR.qmail-run!= \
@@ -56,10 +45,16 @@
                > ${WRKDIR}/README.pkgsrc
        @${SED} ${FILES_SUBST_SED} ${FILESDIR}/mailer.conf              \
                > ${WRKDIR}/mailer.conf
+       @${SED} ${FILES_SUBST_SED} ${FILESDIR}/qmail-procmail.sh        \
+               > ${WRKDIR}/qmail-procmail
+       @${SED} ${FILES_SUBST_SED} ${FILESDIR}/qmail-qfilter-queue.sh   \
+               > ${WRKDIR}/qmail-qfilter-queue
        @${SED} ${FILES_SUBST_SED} ${FILESDIR}/qmail-qread-client.sh    \
                > ${WRKDIR}/qmail-qread-client
 
 do-install:
+       ${INSTALL_SCRIPT} ${WRKDIR}/qmail-procmail ${PREFIX}/bin
+       ${INSTALL_SCRIPT} ${WRKDIR}/qmail-qfilter-queue ${PREFIX}/bin
        ${INSTALL_SCRIPT} ${WRKDIR}/qmail-qread-client ${PREFIX}/bin
        ${INSTALL_DATA} ${WRKDIR}/README.pkgsrc ${PREFIX}/share/doc/qmail-run
        ${INSTALL_DATA} ${WRKDIR}/mailer.conf ${PREFIX}/share/examples/qmail-run
diff -r e53f152a0e7e -r 4f70065cf3a8 mail/qmail-run/PLIST
--- a/mail/qmail-run/PLIST      Mon Aug 23 03:44:34 2004 +0000
+++ b/mail/qmail-run/PLIST      Mon Aug 23 03:47:48 2004 +0000
@@ -1,4 +1,6 @@
-@comment $NetBSD: PLIST,v 1.1.1.1 2004/08/02 03:59:21 schmonz Exp $
+@comment $NetBSD: PLIST,v 1.2 2004/08/23 03:47:48 schmonz Exp $
+bin/qmail-procmail
+bin/qmail-qfilter-queue
 bin/qmail-qread-client
 share/doc/qmail-run/README.pkgsrc
 share/examples/qmail-run/mailer.conf
diff -r e53f152a0e7e -r 4f70065cf3a8 mail/qmail-run/files/qmail-procmail.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/qmail-run/files/qmail-procmail.sh    Mon Aug 23 03:47:48 2004 +0000
@@ -0,0 +1,13 @@
+#!@SH@
+# Copyright (c) 1998-2001 Software in the Public Interest
+# <http://www.debian.org/>
+# Written by Philip Hands. Distributed under the GNU GPL.
+# Modified slightly by Dave Sill.
+
+@PREFIX@/bin/preline @LOCALBASE@/bin/procmail && exit 0
+
+# check if procmail returned EX_TEMPFAIL (75)
+[ $? = 75 ] && exit 111
+
+# otherwise return a permanent error
+exit 100
diff -r e53f152a0e7e -r 4f70065cf3a8 mail/qmail-run/files/qmail-qfilter-queue.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/qmail-run/files/qmail-qfilter-queue.sh       Mon Aug 23 03:47:48 2004 +0000
@@ -0,0 +1,35 @@
+#!@SH@
+#
+# Wrapper for qmail-queue that filters messages before injecting
+#   into the queue.
+#
+# Using this wrapper, executable filters:
+# * Must be placed in @PKG_SYSCONFDIR@/filters
+# * Must have filenames matching "qfilter-*"
+# * 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.
+
+possible_qfilters=`@ECHO@ @PKG_SYSCONFDIR@/filters/qfilter-* | @SORT@`
+qfilters=""
+
+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
+
+qfilter_cmd="@PREFIX@/bin/qmail-qfilter `@ECHO@ ${qfilters} | @SED@ -e 's| | -- |g'`"
+
+exec ${qfilter_cmd}
diff -r e53f152a0e7e -r 4f70065cf3a8 mail/qmail-run/files/qmail.sh
--- a/mail/qmail-run/files/qmail.sh     Mon Aug 23 03:44:34 2004 +0000
+++ b/mail/qmail-run/files/qmail.sh     Mon Aug 23 03:47:48 2004 +0000
@@ -1,10 +1,14 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: qmail.sh,v 1.2 2004/08/03 08:59:24 schmonz Exp $
+# $NetBSD: qmail.sh,v 1.3 2004/08/23 03:47:48 schmonz Exp $
 #
 # @PKGNAME@ master script for administrators to control qmail
 # services. Usage resembles the qmailctl script from "Life with qmail".
 #
+# For Red Hat chkconfig
+# chkconfig: - 80 30
+# description: the qmail MTA
+#
 
 # KEYWORD: nostart
 
@@ -84,7 +88,6 @@
 if [ -f /etc/rc.subr ]; then
        run_rc_command "$1"
 else
-       @ECHO@ -n " ${name}"
        _arg="$1"
        ${start_cmd}
 fi
diff -r e53f152a0e7e -r 4f70065cf3a8 mail/qmail-run/files/qmailpop3d.sh
--- a/mail/qmail-run/files/qmailpop3d.sh        Mon Aug 23 03:44:34 2004 +0000
+++ b/mail/qmail-run/files/qmailpop3d.sh        Mon Aug 23 03:47:48 2004 +0000
@@ -1,17 +1,20 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: qmailpop3d.sh,v 1.2 2004/08/03 08:59:24 schmonz Exp $
+# $NetBSD: qmailpop3d.sh,v 1.3 2004/08/23 03:47:48 schmonz Exp $
 #
 # @PKGNAME@ script to control qmail-pop3d (POP3 server for Maildirs).
 #
 
 # PROVIDE: qmailpop3d mail
 
-. /etc/rc.subr
+if [ -f /etc/rc.subr ]; then
+       . /etc/rc.subr
+fi
 
 name="qmailpop3d"
 rcvar=${name}
 required_files="@PKG_SYSCONFDIR@/control/me"
+required_files="${required_files} @PKG_SYSCONFDIR@/control/concurrencypop3"
 required_files="${required_files} @PKG_SYSCONFDIR@/tcp.pop3.cdb"
 command="@LOCALBASE@/bin/tcpserver"
 procname=${name}
@@ -39,7 +42,7 @@
        # tcpserver(1) is akin to inetd(8), but runs one service per process.
        # We want to signal only the tcpserver process responsible for POP
        # service. Use argv0(1) to set procname to "qmailpop3d".
-       command="@SETENV@ - ${qmailpop3d_postenv} @LOCALBASE@/bin/softlimit -m ${qmailpop3d_datalimit} ${qmailpop3d_pretcpserver} @LOCALBASE@/bin/argv0 @LOCALBASE@/bin/tcpserver ${name} 
${qmailpop3d_tcpflags} -x @PKG_SYSCONFDIR@/tcp.pop3.cdb ${qmailpop3d_tcphost} ${qmailpop3d_tcpport} @LOCALBASE@/bin/qmail-popup `@HEAD@ -1 @PKG_SYSCONFDIR@/control/me` ${qmailpop3d_checkpassword} 
${qmailpop3d_prepop3d} @LOCALBASE@/bin/qmail-pop3d ${qmailpop3d_maildirname} 2>&1 | ${qmailpop3d_logcmd}"
+       command="@SETENV@ - ${qmailpop3d_postenv} @LOCALBASE@/bin/softlimit -m ${qmailpop3d_datalimit} ${qmailpop3d_pretcpserver} @LOCALBASE@/bin/argv0 @LOCALBASE@/bin/tcpserver ${name} 
${qmailpop3d_tcpflags} -x @PKG_SYSCONFDIR@/tcp.pop3.cdb -c `@HEAD@ -1 @PKG_SYSCONFDIR@/control/concurrencypop3` ${qmailpop3d_tcphost} ${qmailpop3d_tcpport} @LOCALBASE@/bin/qmail-popup `@HEAD@ -1 
@PKG_SYSCONFDIR@/control/me` ${qmailpop3d_checkpassword} ${qmailpop3d_prepop3d} @LOCALBASE@/bin/qmail-pop3d ${qmailpop3d_maildirname} 2>&1 | ${qmailpop3d_logcmd}"
        command_args="&"
        rc_flags=""
 }
@@ -75,5 +78,12 @@
        @LOCALBASE@/bin/tcprules @PKG_SYSCONFDIR@/tcp.pop3.cdb @PKG_SYSCONFDIR@/tcp.pop3.tmp < @PKG_SYSCONFDIR@/tcp.pop3
        @CHMOD@ 644 @PKG_SYSCONFDIR@/tcp.pop3.cdb
 }
-load_rc_config $name
-run_rc_command "$1"
+
+if [ -f /etc/rc.subr ]; then
+       load_rc_config $name
+       run_rc_command "$1"
+else
+       @ECHO_N@ " ${name}"
+       qmailpop3d_precmd
+       eval ${command} ${qmailpop3d_flags} ${command_args}
+fi
diff -r e53f152a0e7e -r 4f70065cf3a8 mail/qmail-run/files/qmailqread.sh
--- a/mail/qmail-run/files/qmailqread.sh        Mon Aug 23 03:44:34 2004 +0000
+++ b/mail/qmail-run/files/qmailqread.sh        Mon Aug 23 03:47:48 2004 +0000
@@ -1,6 +1,6 @@



Home | Main Index | Thread Index | Old Index