2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $FreeBSD$
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: mail
|
2012-09-11 05:04:59 +00:00
|
|
|
# REQUIRE: LOGIN FILESYSTEMS
|
2002-06-13 22:14:37 +00:00
|
|
|
# we make mail start late, so that things like .forward's are not
|
|
|
|
# processed until the system is fully operational
|
2008-07-16 19:50:29 +00:00
|
|
|
# KEYWORD: shutdown
|
2001-06-16 07:16:14 +00:00
|
|
|
|
2002-06-13 22:14:37 +00:00
|
|
|
# XXX - Get together with sendmail mantainer to figure out how to
|
|
|
|
# better handle SENDMAIL_ENABLE and 3rd party MTAs.
|
|
|
|
#
|
2001-06-16 07:16:14 +00:00
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="sendmail"
|
2012-01-14 02:18:41 +00:00
|
|
|
rcvar="sendmail_enable"
|
2001-06-16 07:16:14 +00:00
|
|
|
required_files="/etc/mail/${name}.cf"
|
2005-08-30 03:41:59 +00:00
|
|
|
start_precmd="sendmail_precmd"
|
2002-09-02 20:37:03 +00:00
|
|
|
|
2004-01-17 10:59:43 +00:00
|
|
|
load_rc_config $name
|
2005-10-28 16:55:38 +00:00
|
|
|
command=${sendmail_program:-/usr/sbin/${name}}
|
|
|
|
pidfile=${sendmail_pidfile:-/var/run/${name}.pid}
|
|
|
|
procname=${sendmail_procname:-/usr/sbin/${name}}
|
2002-09-02 20:37:03 +00:00
|
|
|
|
2004-01-17 10:59:43 +00:00
|
|
|
case ${sendmail_enable} in
|
|
|
|
[Nn][Oo][Nn][Ee])
|
|
|
|
sendmail_enable="NO"
|
|
|
|
sendmail_submit_enable="NO"
|
|
|
|
sendmail_outbound_enable="NO"
|
|
|
|
sendmail_msp_queue_enable="NO"
|
2002-09-02 20:37:03 +00:00
|
|
|
;;
|
|
|
|
esac
|
2001-06-16 07:16:14 +00:00
|
|
|
|
2004-08-05 03:09:54 +00:00
|
|
|
# If sendmail_enable=yes, don't need submit or outbound daemon
|
|
|
|
if checkyesno sendmail_enable; then
|
|
|
|
sendmail_submit_enable="NO"
|
|
|
|
sendmail_outbound_enable="NO"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If sendmail_submit_enable=yes, don't need outbound daemon
|
|
|
|
if checkyesno sendmail_submit_enable; then
|
|
|
|
sendmail_outbound_enable="NO"
|
|
|
|
fi
|
|
|
|
|
2001-06-16 07:16:14 +00:00
|
|
|
sendmail_precmd()
|
|
|
|
{
|
|
|
|
# Die if there's pre-8.10 custom configuration file. This check is
|
|
|
|
# mandatory for smooth upgrade. See NetBSD PR 10100 for details.
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
if checkyesno ${rcvar} && [ -f "/etc/${name}.cf" ]; then
|
2001-06-16 07:16:14 +00:00
|
|
|
if ! cmp -s "/etc/mail/${name}.cf" "/etc/${name}.cf"; then
|
|
|
|
warn \
|
|
|
|
"${name} was not started; you have multiple copies of sendmail.cf."
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# check modifications on /etc/mail/aliases
|
2007-06-12 17:33:23 +00:00
|
|
|
if checkyesno sendmail_rebuild_aliases; then
|
|
|
|
if [ -f "/etc/mail/aliases.db" ]; then
|
|
|
|
if [ "/etc/mail/aliases" -nt "/etc/mail/aliases.db" ]; then
|
|
|
|
echo \
|
|
|
|
"${name}: /etc/mail/aliases newer than /etc/mail/aliases.db, regenerating"
|
|
|
|
/usr/bin/newaliases
|
|
|
|
fi
|
|
|
|
else
|
2001-06-16 07:16:14 +00:00
|
|
|
echo \
|
2007-06-12 17:33:23 +00:00
|
|
|
"${name}: /etc/mail/aliases.db not present, generating"
|
|
|
|
/usr/bin/newaliases
|
2001-06-16 07:16:14 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
run_rc_command "$1"
|
2002-06-13 22:14:37 +00:00
|
|
|
|
2004-01-17 10:59:43 +00:00
|
|
|
required_files=
|
2002-10-12 10:31:31 +00:00
|
|
|
|
2004-04-17 19:09:09 +00:00
|
|
|
if checkyesno sendmail_submit_enable; then
|
2004-01-17 10:59:43 +00:00
|
|
|
name="sendmail_submit"
|
2012-01-14 02:18:41 +00:00
|
|
|
rcvar="sendmail_submit_enable"
|
2004-01-17 10:59:43 +00:00
|
|
|
start_cmd="${command} ${sendmail_submit_flags}"
|
|
|
|
run_rc_command "$1"
|
|
|
|
fi
|
2002-06-13 22:14:37 +00:00
|
|
|
|
2004-04-17 19:09:09 +00:00
|
|
|
if checkyesno sendmail_outbound_enable; then
|
2004-01-17 10:59:43 +00:00
|
|
|
name="sendmail_outbound"
|
2012-01-14 02:18:41 +00:00
|
|
|
rcvar="sendmail_outbound_enable"
|
2004-01-17 10:59:43 +00:00
|
|
|
start_cmd="${command} ${sendmail_outbound_flags}"
|
2002-06-13 22:14:37 +00:00
|
|
|
run_rc_command "$1"
|
2004-01-17 10:59:43 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
name="sendmail_clientmqueue"
|
|
|
|
rcvar="sendmail_msp_queue_enable"
|
|
|
|
start_cmd="${command} ${sendmail_msp_queue_flags}"
|
|
|
|
pidfile="${sendmail_mspq_pidfile:-/var/spool/clientmqueue/sm-client.pid}"
|
|
|
|
required_files="/etc/mail/submit.cf"
|
|
|
|
run_rc_command "$1"
|