From 5b38ed18fe513214a695ce70aed09da7bfcb1cce Mon Sep 17 00:00:00 2001 From: Kurt Jaeger Date: Sat, 25 Jun 2016 14:44:04 +0000 Subject: mail/qmail: Add rc.d script for qmails queue management daemons PR: 210223 Submitted by: Dirk Engling (maintainer) --- mail/qmail/Makefile | 5 ++-- mail/qmail/files/qmailsend.in | 66 +++++++++++++++++++++++++++++++++++++++++++ mail/qmail/pkg-plist | 7 +++-- 3 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 mail/qmail/files/qmailsend.in (limited to 'mail/qmail') diff --git a/mail/qmail/Makefile b/mail/qmail/Makefile index 969030234fba..ecc23f4c742d 100644 --- a/mail/qmail/Makefile +++ b/mail/qmail/Makefile @@ -3,7 +3,7 @@ PORTNAME= ${QMAIL_PORTNAME} PORTVERSION?= ${QMAIL_VERSION} -PORTREVISION?= 2 +PORTREVISION?= 3 CATEGORIES= mail MASTER_SITES+= QMAIL DISTNAME= ${PORTNAME}-${QMAIL_VERSION} @@ -326,7 +326,7 @@ SUB_FILES+= pkg-message .endif .if !defined(SLAVE_LDAP) -SUB_FILES+= qmailsmtpd +SUB_FILES+= qmailsmtpd qmailsend .endif WRKDIR_doc= ${WRKDIR}/doc @@ -838,6 +838,7 @@ do-install: .endfor .if !defined(SLAVE_LDAP) ${INSTALL_SCRIPT} ${WRKDIR}/qmailsmtpd ${STAGEDIR}${PREFIX}/boot + ${INSTALL_SCRIPT} ${WRKDIR}/qmailsend ${STAGEDIR}${PREFIX}/boot .endif .for i in 1 5 7 8 @${MKDIR} ${STAGEDIR}${PREFIX}/man/man$i diff --git a/mail/qmail/files/qmailsend.in b/mail/qmail/files/qmailsend.in new file mode 100644 index 000000000000..7a3342f43873 --- /dev/null +++ b/mail/qmail/files/qmailsend.in @@ -0,0 +1,66 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: qmailsend +# REQUIRE: network +# +# The wrapper around qmail's qmail-send, qmail-lspawn, qmail-rspawn and +# qmail-clean chain. +# +# the qmailsend_delivery variable controls where mails should be delivered to: +# maildir - qmail-local to ~/Maildir/ (this is the default) +# mailbox - qmail-local to ~/Mailbox +# proc - procmail to /var/spool/mail/$USER +# V7 - /bin/mail V7 interface to /var/spool/mail/$USER +# SVR4 - /bin/mail SVR4 interface to /var/spool/mail/$USER +# BSD44 - /usr/libexec/mail.local to /var/spool/mail/$USER +# +# Setting qmailsend_dotforward enables support for sendmail style +# .forward files +# + +. /etc/rc.subr + +name=qmailsend +rcvar=qmailsend_enable + +load_rc_config $name + +: ${qmailsend_delivery="maildir"} +: ${qmailsend_dotforward="NO"} + +start_cmd="${name}_start" +command="%%PREFIX%%/bin/qmail-start" +procname=qmail-send + +extra_commands="flush" +flush_cmd="qmailsend_flush" + +pidfile="/var/run/${name}.pid" + +qmailsend_start() { + case ${qmailsend_delivery} in + maildir) command_args='./Maildir/';; + mailbox) command_args='./Mailbox';; + proc) command_args='|preline procmail';; + V7) command_args='|preline -f /bin/mail -f "${SENDER:-MAILER-DAEMON}" -d "$USER"';; + SVR4) command_args='|preline -f /bin/mail -r "${SENDER:-MAILER-DAEMON}" -d "$USER"';; + BSD44) command_args='|preline -f /usr/libexec/mail.local -r "${SENDER:-MAILER-DAEMON}" -d "$USER"';; + *) err 1 "Error: Unknown qmailsend delivery method: ${qmailsend_delivery}";; + esac + if checkyesno qmailsend_dotforward; then + command_args='|dot-forward .forward +'"${command_args}" + fi + + exec env - PATH="%%PREFIX%%/bin:$PATH" ${command} \'"${command_args}"\' splogger qmail& + /bin/pgrep -P $$ > ${pidfile} +} + +qmailsend_flush() { + /bin/pkill -ALRM ${rc_pid} +} + +run_rc_command "$1" + diff --git a/mail/qmail/pkg-plist b/mail/qmail/pkg-plist index 5bec0a356aab..c324466a4aca 100644 --- a/mail/qmail/pkg-plist +++ b/mail/qmail/pkg-plist @@ -1,8 +1,10 @@ @unexec for alias in postmaster root mailer-daemon; do if [ -f %D/alias/.qmail-${alias} ] && [ $(stat -f '%%z' %D/alias/.qmail-${alias}) -eq 0 ]; then rm -f %D/alias/.qmail-${alias}; fi; done @exec for alias in postmaster root mailer-daemon; do if ! [ -f %D/alias/.qmail-${alias} ]; then :> %D/alias/.qmail-${alias}; fi; done %%RCDLINK%%@unexec rm -f %%LOCALBASE%%/etc/rc.d/qmailsmtpd -%%RCDLINK%%@exec /bin/ln -fs %D/rc %%LOCALBASE%%/etc/rc.d/qmailsmtpd -%%RCDLINK%%@exec echo; echo "A %%LOCALBASE%%/etc/rc.d/qmailsmtpd symlink was created. To enable qmail at boot time you need to copy a script to %D/rc. There are some examples at %D/boot" | /usr/bin/fmt; echo +%%RCDLINK%%@unexec rm -f %%LOCALBASE%%/etc/rc.d/qmailsend +%%RCDLINK%%@exec /bin/ln -fs %D/boot/qmailsmtpd %%LOCALBASE%%/etc/rc.d/qmailsmtpd +%%RCDLINK%%@exec /bin/ln -fs %D/boot/qmailsend %%LOCALBASE%%/etc/rc.d/qmailsend +%%RCDLINK%%@exec echo; echo "A %%LOCALBASE%%/etc/rc.d/qmailsmtpd and a %%LOCALBASE%%/etc/rc.d/qmailsend symlink were created." | /usr/bin/fmt; echo %%LDAP%%bin/auth_dovecot %%LDAP%%bin/auth_imap %%LDAP%%bin/auth_pop @@ -90,6 +92,7 @@ bin/tcp-env %%NO_LDAP%%boot/proc %%NO_LDAP%%boot/proc+df %%NO_LDAP%%boot/qmailsmtpd +%%NO_LDAP%%boot/qmailsend %%LDAP%%boot/qmail/log/run %%LDAP%%boot/qmail/run %%LDAP%%boot/qmail-smtpd/log/run -- cgit v1.2.3