1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-26 00:55:14 +00:00
freebsd-ports/mail/spamd/files/obspamd.in
Doug Barton 83eb2c3700 In the rc.d scripts, change assignments to rcvar to use the
literal name_enable wherever possible, and ${name}_enable
when it's not, to prepare for the demise of set_rcvar().

In cases where I had to hand-edit unusual instances also
modify formatting slightly to be more uniform (and in
some cases, correct). This includes adding some $FreeBSD$
tags, and most importantly moving rcvar= to right after
name= so it's clear that one is derived from the other.
2012-01-14 08:57:23 +00:00

75 lines
1.5 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: obspamd
# REQUIRE: NETWORKING SERVERS syslogd named
# BEFORE: DAEMON
# KEYWORD: shutdown
#
# Define these spamd_* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
#
# obspamd_enable="YES" # Run the spamd(8) daemon (YES/NO).
# obspamd_flags="" # Extra flags for spamd(8) (if enabled).
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
obspamd_enable=${obspamd_enable:-"NO"}
. /etc/rc.subr
name="obspamd"
rcvar=obspamd_enable
command="%%PREFIX%%/libexec/%%SPAMDBIN%%"
start_precmd="obspamd_precmd"
start_postcmd="obspamd_postcmd"
restart_postcmd="obspamd_postcmd"
stop_postcmd="obspamd_cleanup"
pidfile="/var/run/spamd.pid"
obspamd_precmd()
{
_rc=0
echo "${obspamd_flags}" | egrep "(^\-b| \-b)" 2>&1 > /dev/null
if [ $? -eq 1 ]; then
/sbin/mount -p | grep 'fdescfs.*/dev/fd.*fdescfs.*rw' 2>&1 > /dev/null
_rc=${?}
if [ ${_rc} -ne 0 ]; then
echo "Unable to start spamd in greylisting mode"
echo ""
echo "Please mount fdescfs with the following line in /etc/fstab"
echo ""
echo " fdescfs /dev/fd fdescfs rw 0 0"
echo ""
fi
return ${_rc}
fi
}
obspamd_postcmd()
{
if [ -x %%PREFIX%%/sbin/spamd-setup ]; then
if [ -r %%PREFIX%%/etc/spamd/spamd.conf ]; then
echo "${obspamd_flags}" | egrep "(^\-b| \-b)" 2>&1 > /dev/null
if [ $? -eq 0 ]; then
%%PREFIX%%/sbin/spamd-setup -bD
else
%%PREFIX%%/sbin/spamd-setup -D
fi
fi
fi
}
obspamd_cleanup()
{
/bin/rm -f ${pidfile}
}
load_rc_config $name
run_rc_command "$1"