#!/bin/sh # PROVIDE: smtpd mail # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable smtpd: # smtpd_enable (bool): Set it to "YES" to enable OpenSMTPD. # Default is "NO". # smtpd_config (string): Path to OpenSMTPD configuration file. # Default is "%%PREFIX%%/etc/mail/smtpd.conf" # smtpd_flags (string): Additional flags to be passed to smtpd. # Default is "". # # . /etc/rc.subr name="smtpd" rcvar=smtpd_enable start_precmd="smtpd_precmd" restart_precmd="smtpd_checkconfig" configtest_cmd="smtpd_checkconfig" extra_commands="configtest" load_rc_config $name : ${smtpd_enable:="NO"} : ${smtpd_config:="%%PREFIX%%/etc/mail/${name}.conf"} : ${smtpd_procname:="%%PREFIX%%/sbin/${name}"} : ${smtpd_flags:=""} command=${smtpd_procname} command_args="-f ${smtpd_config} ${command_args}" required_files="${smtpd_config}" procname=${smtpd_procname} pidfile="/var/run/${name}.pid" smtpd_checkconfig() { echo "Performing sanity check on smtpd configuration:" eval ${command} ${command_args} ${smtpd_flags} -n } smtpd_precmd() { smtpd_checkconfig } run_rc_command "$1"