1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00

- Convert RC script to rc_subr

PR:		ports/91595
Submitted by:	Hirohisa Yamaguchi <umq@ueo.co.jp>
This commit is contained in:
Pav Lucistnik 2006-01-15 09:11:04 +00:00
parent 1068fca2cf
commit 853594a45b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=153547
3 changed files with 46 additions and 51 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= dk-milter
PORTVERSION= 0.3.2
PORTREVISION= 1
CATEGORIES= mail
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= dk-milter
@ -14,6 +15,8 @@ MASTER_SITE_SUBDIR= dk-milter
MAINTAINER= ports@FreeBSD.org
COMMENT= Domainkeys milter for Sendmail
USE_RC_SUBR= milter-dk.sh
.if !defined(SENDMAIL_MILTER_IN_BASE)
.if defined(SENDMAIL_WITH_SHARED_MILTER)
LIB_DEPENDS+= milter.3:${PORTSDIR}/mail/${SENDMAIL_MILTER_PORT}
@ -59,8 +62,6 @@ post-install:
-${STRIP_CMD} ${PREFIX}/libexec/dk-filter
${INSTALL_SCRIPT} ${WRKSRC}/dk-filter/gentxt.csh \
${PREFIX}/sbin/gentxt
${INSTALL_DATA} ${WRKDIR}/milter-dk.sh \
${PREFIX}/etc/rc.d/milter-dk.sh.sample
.for i in ${MAN8}
@${RM} -f ${MANPREFIX}/man/cat8/${i} ${MANPREFIX}/man/cat8/${i}.gz
${INSTALL_MAN} ${WRKSRC}/*/${i} ${MANPREFIX}/man/man8/

View File

@ -1,51 +1,46 @@
#!/bin/sh
#
# $FreeBSD$
#
if ! test -x %%PREFIX%%/libexec/dk-filter
then
exit 0
fi
dk_filter_args="-d example.com -c nofws -H -m MSA -s /var/db/domainkeys/default.key.pem -S default"
case "$1" in
start)
sh "${0}" wait
rm -f /var/run/dk-filter.pid /var/run/dk-filter
%%PREFIX%%/libexec/dk-filter -l -p local:/var/run/dk-filter \
-P /var/run/dk-filter.pid ${dk_filter_args}
echo -n ' dk-filter'
;;
stop)
if test -r /var/run/dk-filter.pid
then
kill `head -1 /var/run/dk-filter.pid`
else
echo " dk-filter: not running" 2>&1
fi
sh "${0}" wait
rm -f /var/run/dk-filter.pid
;;
wait)
while ps -axw -o pid,command | egrep "^[0-9]+ %%PREFIX%%/libexec/dk-filter "
do
echo "please wait"
sleep 1
done
;;
restart)
"$0" stop
"$0" start
;;
status)
if [ -z "$(ps -axw -o pid,command | egrep "^[0-9]+ %%PREFIX%%/libexec/dk-filter ")" ]
then
echo "FAILED dk-filter is not running!"
else
echo "OK dk-filter is running!"
fi
;;
*)
echo "Usage: ${0##*/}: {start|stop|restart|status}" >&2
exit 64
;;
esac
#
# PROVIDE: milterdk
# REQUIRE: DAEMON
# BEFORE: sendmail
# KEYWORD: shutdown
# Define these milterdk_* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
# /etc/rc.conf.d/milterdk
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
milterdk_enable=${milterdk_enable:-"NO"}
milterdk_socket=${milterdk_socket:-"local:/var/run/dk-filter"}
milterdk_pid=${milterdk_pid:-"/var/run/dk-filter.pid"}
milterdk_domain=${milterdk_domain:-"example.com"}
milterdk_key=${milterdk_key:-"/var/db/domainkeys/default.key.pem"}
milterdk_flags=${milterdk_flags:-"-d ${milterdk_domain} -c nofws -H -m MSA \
-s ${milterdk_key} -S default"}
. %%RC_SUBR%%
name="milterdk"
pidfile=${milterdk_pid}
rcvar=`set_rcvar`
command="%%PREFIX%%/libexec/dk-filter"
command_args="-l -p ${milterdk_socket} -P ${milterdk_pid}"
stop_postcmd="dk_postcmd"
load_rc_config $name
dk_postcmd ()
{
if [ -S ${milterdk_socket##local:} ] ; then
rm -f ${milterdk_socket##local:}
elif [ -S ${milterdk_socket##unix:} ] ; then
rm -f ${milterdk_socket##unix:}
fi
}
run_rc_command "$1"

View File

@ -1,4 +1,3 @@
etc/rc.d/milter-dk.sh.sample
libexec/dk-filter
sbin/gentxt
%%PORTDOCS%%%%DOCSDIR%%/FEATURES