diff options
author | pav <pav@FreeBSD.org> | 2006-01-15 09:11:04 +0000 |
---|---|---|
committer | pav <pav@FreeBSD.org> | 2006-01-15 09:11:04 +0000 |
commit | c46f4b042a58f737997d38ee07647763b8ab7b00 (patch) | |
tree | 52988629c4d41fdc753015cfd560829fcb88409b /mail/dk-milter | |
parent | 546cd98164eecfa489b5eb86d5b73657b74cea93 (diff) | |
download | FreeBSD-ports-c46f4b042a58f737997d38ee07647763b8ab7b00.zip FreeBSD-ports-c46f4b042a58f737997d38ee07647763b8ab7b00.tar.gz |
- Convert RC script to rc_subr
PR: ports/91595
Submitted by: Hirohisa Yamaguchi <umq@ueo.co.jp>
Diffstat (limited to 'mail/dk-milter')
-rw-r--r-- | mail/dk-milter/Makefile | 5 | ||||
-rw-r--r-- | mail/dk-milter/files/milter-dk.sh.in | 91 | ||||
-rw-r--r-- | mail/dk-milter/pkg-plist | 1 |
3 files changed, 46 insertions, 51 deletions
diff --git a/mail/dk-milter/Makefile b/mail/dk-milter/Makefile index ecd2467..369d814 100644 --- a/mail/dk-milter/Makefile +++ b/mail/dk-milter/Makefile @@ -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/ diff --git a/mail/dk-milter/files/milter-dk.sh.in b/mail/dk-milter/files/milter-dk.sh.in index 702efab..d6eb86a1 100644 --- a/mail/dk-milter/files/milter-dk.sh.in +++ b/mail/dk-milter/files/milter-dk.sh.in @@ -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" diff --git a/mail/dk-milter/pkg-plist b/mail/dk-milter/pkg-plist index 941bc55..7dad930 100644 --- a/mail/dk-milter/pkg-plist +++ b/mail/dk-milter/pkg-plist @@ -1,4 +1,3 @@ -etc/rc.d/milter-dk.sh.sample libexec/dk-filter sbin/gentxt %%PORTDOCS%%%%DOCSDIR%%/FEATURES |