summaryrefslogtreecommitdiff
path: root/mail/nullmailer/files
diff options
context:
space:
mode:
Diffstat (limited to 'mail/nullmailer/files')
-rw-r--r--mail/nullmailer/files/nullmailer-daemon13
-rw-r--r--mail/nullmailer/files/nullmailer.sh32
2 files changed, 24 insertions, 21 deletions
diff --git a/mail/nullmailer/files/nullmailer-daemon b/mail/nullmailer/files/nullmailer-daemon
deleted file mode 100644
index 468b146cf9c..00000000000
--- a/mail/nullmailer/files/nullmailer-daemon
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-#
-# ensure that the trigger fifo exists and we own it, then start up
-# nullmailer-send with logging and detach
-
-trigger="@VARBASE@/spool/nullmailer/trigger"
-
-if [ ! -p ${trigger} -o ! -O ${trigger} -o ! -G ${trigger} ]; then
- rm -f ${trigger}
- mkfifo -m 0600 ${trigger}
-fi
-
-@PREFIX@/libexec/nullmailer/nullmailer-send 2>&1 | logger -t nullmailer -p mail.info &
diff --git a/mail/nullmailer/files/nullmailer.sh b/mail/nullmailer/files/nullmailer.sh
index b03682f50f3..60b6c63e3e4 100644
--- a/mail/nullmailer/files/nullmailer.sh
+++ b/mail/nullmailer/files/nullmailer.sh
@@ -1,28 +1,44 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: nullmailer.sh,v 1.4 2009/10/14 21:13:41 plunky Exp $
+# $NetBSD: nullmailer.sh,v 1.5 2017/10/28 04:51:06 schmonz Exp $
#
+# @PKGNAME@ script to control nullmailer (simple relay-only MTA).
+#
+
# PROVIDE: mail
-# REQUIRE: LOGIN
+
+name="nullmailer"
+
+# User-settable rc.conf variables and their default values:
+: ${nullmailer_postenv:=""}
+: ${nullmailer_logcmd:="logger -t nb${name} -p mail.info"}
if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
-name="nullmailer"
rcvar=${name}
required_files="@PKG_SYSCONFDIR@/nullmailer/remotes"
required_dirs="@VARBASE@/spool/nullmailer/queue @VARBASE@/spool/nullmailer/tmp"
-command="@PREFIX@/libexec/nullmailer/nullmailer-daemon"
-procname="@PREFIX@/libexec/nullmailer/nullmailer-send"
+command="@PREFIX@/libexec/nullmailer/nullmailer-send"
+start_precmd="nullmailer_prestart"
-nullmailer_user="@NULLMAILER_USER@"
-nullmailer_group="@NULLMAILER_GROUP@"
+nullmailer_prestart()
+{
+ command="@PREFIX@/bin/pgrphack @SETENV@ - ${nullmailer_postenv}
+@PREFIX@/bin/setuidgid @NULLMAILER_USER@ @PREFIX@/libexec/nullmailer/nullmailer-send
+2>&1 |
+@PREFIX@/bin/pgrphack @PREFIX@/bin/setuidgid @NULLMAILER_USER@ ${nullmailer_logcmd}"
+ command_args="&"
+ rc_flags=""
+}
if [ -f /etc/rc.subr ]; then
load_rc_config $name
run_rc_command "$1"
else
@ECHO_N@ " ${name}"
- ${command} ${nullmailer_flags} ${command_args}
+ nullmailer_prestart
+ eval ${command} ${nullmailer_flags} ${command_args}
+ nullmailer_poststart
fi