From 0340be5126d9bdd568870cafd842880bd6c2da2b Mon Sep 17 00:00:00 2001 From: schmonz Date: Mon, 2 Aug 2004 03:59:21 +0000 Subject: This package creates all the needed basic config files to run qmail, and provides NetBSD-style rc.d scripts and an example mailer.conf. The rc.d scripts used to belong directly to the qmail package. Changes made during the move here: * Rename qmailfoo_softlimit to the more accurate qmailfoo_datalimit. * Parameterize logging as qmailfoo_logcmd (default: splogger). * Run all sploggers (not just qmail-send's) as user qmaill, rather than root. * Replace "@CAT@" with "@HEAD@ -1" for files expected to contain one line. --- mail/qmail-run/DESCR | 2 + mail/qmail-run/INSTALL | 43 ++++++++++++++ mail/qmail-run/MESSAGE | 21 +++++++ mail/qmail-run/Makefile | 66 +++++++++++++++++++++ mail/qmail-run/PLIST | 6 ++ mail/qmail-run/files/README.pkgsrc | 44 ++++++++++++++ mail/qmail-run/files/mailer.conf | 10 ++++ mail/qmail-run/files/qmail-qread-client.sh | 7 +++ mail/qmail-run/files/qmail.sh | 90 +++++++++++++++++++++++++++++ mail/qmail-run/files/qmailpop3d.sh | 79 +++++++++++++++++++++++++ mail/qmail-run/files/qmailqread.sh | 31 ++++++++++ mail/qmail-run/files/qmailsend.sh | 92 ++++++++++++++++++++++++++++++ mail/qmail-run/files/qmailsmtpd.sh | 80 ++++++++++++++++++++++++++ 13 files changed, 571 insertions(+) create mode 100644 mail/qmail-run/DESCR create mode 100644 mail/qmail-run/INSTALL create mode 100644 mail/qmail-run/MESSAGE create mode 100644 mail/qmail-run/Makefile create mode 100644 mail/qmail-run/PLIST create mode 100644 mail/qmail-run/files/README.pkgsrc create mode 100644 mail/qmail-run/files/mailer.conf create mode 100644 mail/qmail-run/files/qmail-qread-client.sh create mode 100644 mail/qmail-run/files/qmail.sh create mode 100644 mail/qmail-run/files/qmailpop3d.sh create mode 100644 mail/qmail-run/files/qmailqread.sh create mode 100644 mail/qmail-run/files/qmailsend.sh create mode 100644 mail/qmail-run/files/qmailsmtpd.sh (limited to 'mail/qmail-run') diff --git a/mail/qmail-run/DESCR b/mail/qmail-run/DESCR new file mode 100644 index 00000000000..d2207e68052 --- /dev/null +++ b/mail/qmail-run/DESCR @@ -0,0 +1,2 @@ +This package creates all the needed basic config files to run qmail, +and provides NetBSD-style rc.d scripts and an example mailer.conf. diff --git a/mail/qmail-run/INSTALL b/mail/qmail-run/INSTALL new file mode 100644 index 00000000000..86ee6c5ebfb --- /dev/null +++ b/mail/qmail-run/INSTALL @@ -0,0 +1,43 @@ +QMAIL_QUEUE_EXTRA=@QMAIL_QUEUE_EXTRA@ + +psmsg='# This file was auto-generated by pkgsrc.' + +case ${STAGE} in + +POST-INSTALL) + cd ${LOCALBASE}/share/qmail/setup && ./config-fast `./hostname` + + cd ${PKG_SYSCONFDIR}/alias && ${TOUCH} .qmail-postmaster .qmail-mailer-daemon .qmail-root + + if ! [ -s ${PKG_SYSCONFDIR}/control/concurrencyincoming ]; then + ${ECHO} 20 > ${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 + ${CHMOD} 644 ${PKG_SYSCONFDIR}/control/defaultdelivery + fi + + pop3rule=':allow' + smtprule='127.:allow,RELAYCLIENT=""' + for i in pop3 smtp; do + if ! [ -s ${PKG_SYSCONFDIR}/tcp.${i} ]; then + ${ECHO} $psmsg > ${PKG_SYSCONFDIR}/tcp.${i} + eval ${ECHO} \"\$${i}rule\" > ${PKG_SYSCONFDIR}/tcp.${i} + fi + ${CHMOD} 644 ${PKG_SYSCONFDIR}/tcp.${i} + ${LOCALBASE}/bin/tcprules ${PKG_SYSCONFDIR}/tcp.${i}.cdb ${PKG_SYSCONFDIR}/tcp.${i}.tmp < ${PKG_SYSCONFDIR}/tcp.${i} + ${CHMOD} 644 ${PKG_SYSCONFDIR}/tcp.${i}.cdb + done + + if ! [ -z ${QMAIL_QUEUE_EXTRA} ]; then + ${ECHO} $psmsg >> ${PKG_SYSCONFDIR}/alias/.qmail-${QMAIL_QUEUE_EXTRA} + ${CHMOD} 644 ${PKG_SYSCONFDIR}/alias/.qmail-${QMAIL_QUEUE_EXTRA} + fi + + ;; + +esac diff --git a/mail/qmail-run/MESSAGE b/mail/qmail-run/MESSAGE new file mode 100644 index 00000000000..e100a17ed06 --- /dev/null +++ b/mail/qmail-run/MESSAGE @@ -0,0 +1,21 @@ +=========================================================================== +$NetBSD: MESSAGE,v 1.1.1.1 2004/08/02 03:59:21 schmonz Exp $ + +To enable qmail for + +Local and outgoing deliveries: +- Check the configuration files in ${PKG_SYSCONFDIR}. +- Modify /etc/mailer.conf (see share/examples/qmail-run/mailer.conf). +- Set qmailsend=YES in /etc/rc.conf. + +SMTP: +- Set qmailsmtpd=YES in /etc/rc.conf. + +POP3 (only for Maildirs): +- Set qmailpop3d=YES in /etc/rc.conf. + +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 new file mode 100644 index 00000000000..1e26d57e69e --- /dev/null +++ b/mail/qmail-run/Makefile @@ -0,0 +1,66 @@ +# $NetBSD: Makefile,v 1.1.1.1 2004/08/02 03:59:21 schmonz Exp $ +# + +DISTNAME= qmail-run-20040801 +CATEGORIES= mail +MASTER_SITES= # empty +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+= ${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 + +WRKSRC= ${WRKDIR} +NO_CHECKSUM= # defined + +USE_PKGINSTALL= yes +INSTALL_EXTRA_TMPL+= ${.CURDIR}/INSTALL +FILES_SUBST+= QMAIL_QUEUE_EXTRA=${QMAIL_QUEUE_EXTRA} +RCD_SCRIPTS= qmail qmailqread qmailpop3d 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. +.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 +. if empty(INSTALLED_QMAIL:M*_not_found_) +. if !defined(PKG_SYSCONFDIR.qmail-run) +PKG_SYSCONFDIR.qmail-run!= \ + ${PKG_INFO} -qB ${INSTALLED_QMAIL} | \ + ${SED} -n '/^PKG_SYSCONFDIR=/s|^PKG_SYSCONFDIR=[ ]*||p' +. endif +. endif +.endif + +do-build: + @${SED} ${FILES_SUBST_SED} ${FILESDIR}/README.pkgsrc \ + > ${WRKDIR}/README.pkgsrc + @${SED} ${FILES_SUBST_SED} ${FILESDIR}/mailer.conf \ + > ${WRKDIR}/mailer.conf + @${SED} ${FILES_SUBST_SED} ${FILESDIR}/qmail-qread-client.sh \ + > ${WRKDIR}/qmail-qread-client + +do-install: + ${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 + +.include "../../mk/bsd.pkg.mk" diff --git a/mail/qmail-run/PLIST b/mail/qmail-run/PLIST new file mode 100644 index 00000000000..da21ef4d72e --- /dev/null +++ b/mail/qmail-run/PLIST @@ -0,0 +1,6 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2004/08/02 03:59:21 schmonz Exp $ +bin/qmail-qread-client +share/doc/qmail-run/README.pkgsrc +share/examples/qmail-run/mailer.conf +@dirrm share/examples/qmail-run +@dirrm share/doc/qmail-run diff --git a/mail/qmail-run/files/README.pkgsrc b/mail/qmail-run/files/README.pkgsrc new file mode 100644 index 00000000000..04813eeba90 --- /dev/null +++ b/mail/qmail-run/files/README.pkgsrc @@ -0,0 +1,44 @@ + Getting help + ============ + +You've installed an automated and customized qmail-run package. If +you're having trouble getting the qmail daemons to run, ask the +package's maintainer (). + +While qmail includes installation instructions, many members of +the qmail list instead recommend following Dave Sill's "Life with +qmail" document: + + + +The qmail package you've installed follows LWQ in many aspects, +but consciously deviates from it in others. Therefore, if you need +to ask for help on the qmail list, please mention that you use the +pkgsrc qmail-run package. If you can first reproduce your problem +on a manual LWQ-style installation, your request for help is likely +to be better received. + +It is highly recommended that you read Charles Cazabon's "12 Steps +to qmail List Bliss" before posting to the list: + + + + + Deviations from LWQ + =================== + +LWQ suggests doing some things that the qmail package doesn't do: +* Copying a script from /var/qmail/boot to /var/qmail/rc. +* Configuring svscan(8) to run at boot. +* Creating and/or populating /service. +* Using supervise(8) and multilog(8). +* Using the qmailctl script to control qmail. +* Using the inst_check script to verify the installation. +* Storing tcp.smtp{,cdb} in /etc. +* Renaming the system sendmail(8) and marking it non-executable. + +Instead, to behave more like a typical pkgsrc package, the package: +* Provides NetBSD-style rc.d scripts, including one very similar to qmailctl. +* Sends log messages to syslog(3) by default. +* Stores tcp.smtp{,cdb} and tcp.pop3{,cdb} in ${PKG_SYSCONFDIR}. +* Uses mailwrapper(8) and mailer.conf(5). diff --git a/mail/qmail-run/files/mailer.conf b/mail/qmail-run/files/mailer.conf new file mode 100644 index 00000000000..db57f7371e4 --- /dev/null +++ b/mail/qmail-run/files/mailer.conf @@ -0,0 +1,10 @@ +# $NetBSD: mailer.conf,v 1.1.1.1 2004/08/02 03:59:22 schmonz Exp $ +# +# Use qmail as the system mailer. +# +sendmail @LOCALBASE@/bin/sendmail +send-mail @LOCALBASE@/bin/sendmail +mailq @LOCALBASE@/bin/qmail-qread +newaliases @LOCALBASE@/bin/newaliases +hoststat @LOCALBASE@/bin/qmail-tcpto +purgestat @LOCALBASE@/bin/qmail-tcpok diff --git a/mail/qmail-run/files/qmail-qread-client.sh b/mail/qmail-run/files/qmail-qread-client.sh new file mode 100644 index 00000000000..1a175d07787 --- /dev/null +++ b/mail/qmail-run/files/qmail-qread-client.sh @@ -0,0 +1,7 @@ +#!@SH@ +# +# Client program to allow local non-root users to see the queue. +# Requires that the corresponding server program be running. From +# Steinar Haug. + +exec @LOCALBASE@/bin/tcpclient -RHl0 -- 127.0.0.1 20025 @SH@ -c 'exec @CAT@ <&6' diff --git a/mail/qmail-run/files/qmail.sh b/mail/qmail-run/files/qmail.sh new file mode 100644 index 00000000000..711e1aff5f5 --- /dev/null +++ b/mail/qmail-run/files/qmail.sh @@ -0,0 +1,90 @@ +#!@RCD_SCRIPTS_SHELL@ +# +# $NetBSD: qmail.sh,v 1.1.1.1 2004/08/02 03:59:22 schmonz Exp $ +# +# Master script for administrators to control qmail services. +# Usage resembles the qmailctl script from "Life with qmail". +# + +# KEYWORD: nostart + +if [ -f /etc/rc.subr ]; then + . /etc/rc.subr +fi + +rcd_dir=`@DIRNAME@ $0` + +# NOTE: run_rc_command sets $rc_arg +# +forward_commands() +{ + # Backward compat with NetBSD <1.6: + [ -z "$rc_arg" ] && rc_arg=$_arg + + for file in $COMMAND_LIST; do + $rcd_dir/$file $rc_arg + done +} + +reverse_commands() +{ + # Backward compat with NetBSD <1.6: + [ -z "$rc_arg" ] && rc_arg=$_arg + + REVCOMMAND_LIST= + for file in $COMMAND_LIST; do + REVCOMMAND_LIST="$file $REVCOMMAND_LIST" + done + for file in $REVCOMMAND_LIST; do + $rcd_dir/$file $rc_arg + done +} + +qmailrcd() +{ + for service in $@; do + $rcd_dir/qmail${service} $rc_arg + done +} + +qmail_help() +{ + @CAT@ <