summaryrefslogtreecommitdiff
path: root/mail/qmail-run
diff options
context:
space:
mode:
authorschmonz <schmonz>2004-08-23 03:47:48 +0000
committerschmonz <schmonz>2004-08-23 03:47:48 +0000
commitc492e2554c4dc6b1432a738457ef438ed015c50c (patch)
tree4ae6eda6f9df4c06bc59c0d19862845d2b58706d /mail/qmail-run
parent61dc51754fa95b2c2126c62ce9efffc3dbd94634 (diff)
downloadpkgsrc-c492e2554c4dc6b1432a738457ef438ed015c50c.tar.gz
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 (limited to 'mail/qmail-run')
-rw-r--r--mail/qmail-run/DESCR1
-rw-r--r--mail/qmail-run/INSTALL17
-rw-r--r--mail/qmail-run/MESSAGE4
-rw-r--r--mail/qmail-run/Makefile31
-rw-r--r--mail/qmail-run/PLIST4
-rw-r--r--mail/qmail-run/files/qmail-procmail.sh13
-rw-r--r--mail/qmail-run/files/qmail-qfilter-queue.sh35
-rw-r--r--mail/qmail-run/files/qmail.sh7
-rw-r--r--mail/qmail-run/files/qmailpop3d.sh20
-rw-r--r--mail/qmail-run/files/qmailqread.sh16
-rw-r--r--mail/qmail-run/files/qmailsend.sh16
-rw-r--r--mail/qmail-run/files/qmailsmtpd.sh16
12 files changed, 135 insertions, 45 deletions
diff --git a/mail/qmail-run/DESCR b/mail/qmail-run/DESCR
index d2207e68052..b9b4bf45872 100644
--- a/mail/qmail-run/DESCR
+++ b/mail/qmail-run/DESCR
@@ -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 --git a/mail/qmail-run/INSTALL b/mail/qmail-run/INSTALL
index 86ee6c5ebfb..1ad1efd7be9 100644
--- a/mail/qmail-run/INSTALL
+++ b/mail/qmail-run/INSTALL
@@ -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 @@ POST-INSTALL)
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 @@ POST-INSTALL)
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 @@ POST-INSTALL)
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 --git a/mail/qmail-run/MESSAGE b/mail/qmail-run/MESSAGE
index a7fc5f3eaca..5832d991f12 100644
--- a/mail/qmail-run/MESSAGE
+++ b/mail/qmail-run/MESSAGE
@@ -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 @@ SMTP:
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 --git a/mail/qmail-run/Makefile b/mail/qmail-run/Makefile
index 2131e042037..0e06269ca45 100644
--- a/mail/qmail-run/Makefile
+++ b/mail/qmail-run/Makefile
@@ -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 @@ DISTFILES= # empty
MAINTAINER= schmonz@NetBSD.org
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 @@ USE_PKGINSTALL= yes
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 @@ do-build:
> ${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 --git a/mail/qmail-run/PLIST b/mail/qmail-run/PLIST
index da21ef4d72e..8ba4fe3fd61 100644
--- a/mail/qmail-run/PLIST
+++ b/mail/qmail-run/PLIST
@@ -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 --git a/mail/qmail-run/files/qmail-procmail.sh b/mail/qmail-run/files/qmail-procmail.sh
new file mode 100644
index 00000000000..69d66cf88a6
--- /dev/null
+++ b/mail/qmail-run/files/qmail-procmail.sh
@@ -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 --git a/mail/qmail-run/files/qmail-qfilter-queue.sh b/mail/qmail-run/files/qmail-qfilter-queue.sh
new file mode 100644
index 00000000000..f17db1198f3
--- /dev/null
+++ b/mail/qmail-run/files/qmail-qfilter-queue.sh
@@ -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 --git a/mail/qmail-run/files/qmail.sh b/mail/qmail-run/files/qmail.sh
index aa411838e08..a4599aa899e 100644
--- a/mail/qmail-run/files/qmail.sh
+++ b/mail/qmail-run/files/qmail.sh
@@ -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 @@ extra_commands="pause cont stat status cdb doqueue reload queue alrm flush hup h
if [ -f /etc/rc.subr ]; then
run_rc_command "$1"
else
- @ECHO@ -n " ${name}"
_arg="$1"
${start_cmd}
fi
diff --git a/mail/qmail-run/files/qmailpop3d.sh b/mail/qmail-run/files/qmailpop3d.sh
index 6460961a68b..9506cf0b623 100644
--- a/mail/qmail-run/files/qmailpop3d.sh
+++ b/mail/qmail-run/files/qmailpop3d.sh
@@ -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 @@ qmailpop3d_precmd()
# 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 @@ qmailpop3d_cdb()
@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 --git a/mail/qmail-run/files/qmailqread.sh b/mail/qmail-run/files/qmailqread.sh
index 37d984196d7..17cca739097 100644
--- a/mail/qmail-run/files/qmailqread.sh
+++ b/mail/qmail-run/files/qmailqread.sh
@@ -1,6 +1,6 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: qmailqread.sh,v 1.2 2004/08/03 08:59:24 schmonz Exp $
+# $NetBSD: qmailqread.sh,v 1.3 2004/08/23 03:47:48 schmonz Exp $
#
# @PKGNAME@ script to control a service providing local non-root
# users access to see the queue. Adapted from a script by Steinar Haug.
@@ -9,7 +9,9 @@
# PROVIDE: qmailqread mail
# REQUIRE: qmailsend
-. /etc/rc.subr
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
name="qmailqread"
rcvar=${name}
@@ -27,5 +29,11 @@ qmailqread_precmd()
rc_flags=""
}
-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}"
+ qmailqread_precmd
+ eval ${command} ${qmailqread_flags} ${command_args}
+fi
diff --git a/mail/qmail-run/files/qmailsend.sh b/mail/qmail-run/files/qmailsend.sh
index 2bd73865273..6b0be89ac75 100644
--- a/mail/qmail-run/files/qmailsend.sh
+++ b/mail/qmail-run/files/qmailsend.sh
@@ -1,6 +1,6 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: qmailsend.sh,v 1.2 2004/08/03 08:59:24 schmonz Exp $
+# $NetBSD: qmailsend.sh,v 1.3 2004/08/23 03:47:48 schmonz Exp $
#
# @PKGNAME@ script to control qmail-send (local and outgoing mail).
#
@@ -9,7 +9,9 @@
# REQUIRE: LOGIN
# KEYWORD: shutdown
-. /etc/rc.subr
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
name="qmailsend"
rcvar=${name}
@@ -88,5 +90,11 @@ qmailsend_hup()
run_rc_command reload
}
-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}"
+ qmailsend_precmd
+ eval ${command} ${qmailsend_flags} ${command_args}
+fi
diff --git a/mail/qmail-run/files/qmailsmtpd.sh b/mail/qmail-run/files/qmailsmtpd.sh
index 18cdb146c38..aafb26603b4 100644
--- a/mail/qmail-run/files/qmailsmtpd.sh
+++ b/mail/qmail-run/files/qmailsmtpd.sh
@@ -1,6 +1,6 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: qmailsmtpd.sh,v 1.2 2004/08/03 08:59:24 schmonz Exp $
+# $NetBSD: qmailsmtpd.sh,v 1.3 2004/08/23 03:47:48 schmonz Exp $
#
# @PKGNAME@ script to control qmail-smtpd (SMTP service).
#
@@ -8,7 +8,9 @@
# PROVIDE: qmailsmtpd mail
# REQUIRE: qmailsend
-. /etc/rc.subr
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
name="qmailsmtpd"
rcvar=${name}
@@ -77,5 +79,11 @@ qmailsmtpd_cdb()
@CHMOD@ 644 @PKG_SYSCONFDIR@/tcp.smtp.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}"
+ qmailsmtpd_precmd
+ eval ${command} ${qmailsmtpd_flags} ${command_args}
+fi