From ae88725e1a19a0874666adca6ba0201029deb811 Mon Sep 17 00:00:00 2001 From: Edwin Groothuis Date: Tue, 13 Jan 2004 08:29:28 +0000 Subject: [PATCH] [PATCH] mail/p5-Mail-SpamAssassin 2.60 This patch adds rc_subr support to spamd daemon of the spamassassin port. PR: ports/57384 Submitted by: Martin Matuska --- mail/p5-Mail-SpamAssassin/Makefile | 17 +++++++- mail/p5-Mail-SpamAssassin/files/spamd.sh | 52 +++++++++++++++++------- mail/p5-Mail-SpamAssassin/pkg-plist | 2 +- 3 files changed, 54 insertions(+), 17 deletions(-) diff --git a/mail/p5-Mail-SpamAssassin/Makefile b/mail/p5-Mail-SpamAssassin/Makefile index 6b496197f742..8dadbe4ca3f9 100644 --- a/mail/p5-Mail-SpamAssassin/Makefile +++ b/mail/p5-Mail-SpamAssassin/Makefile @@ -7,6 +7,7 @@ PORTNAME= Mail-SpamAssassin PORTVERSION= 2.61 +PORTREVISION= 1 CATEGORIES= mail perl5 MASTER_SITES= http://spamassassin.org/released/ \ ${MASTER_SITE_PERL_CPAN} @@ -51,6 +52,17 @@ MAN1= spamd.1 spamassassin.1 spamc.1 sa-learn.1 DOCSDIR= ${PREFIX}/share/doc/${PKGNAMEPREFIX}${PORTNAME} +SED_SCRIPT= -e 's|%%PREFIX%%|${PREFIX}|g' + +USE_RC_SUBR= yes +RC_DIR= ${PREFIX}/etc/rc.d +RC_SUFX= .sh +SED_SCRIPT+= -e 's|%%RC_SUBR%%|${RC_SUBR}|g' \ + -e 's|%%RC_DIR%%|${RC_DIR}|g' \ + -e 's|%%RC_SUFX%%|${RC_SUFX}|g' +PLIST_SUB+= RC_DIR=${RC_DIR} \ + RC_SUFX=${RC_SUFX} + post-patch: @${FIND} ${WRKSRC} -name \*.orig -delete @@ -59,9 +71,12 @@ post-patch: ${WRKSRC}/Makefile.PL > ${WRKSRC}/Makefile.PL.sed @${MV} ${WRKSRC}/Makefile.PL.sed ${WRKSRC}/Makefile.PL +post-build: + @${SED} ${SED_SCRIPT} ${FILESDIR}/spamd.sh > ${WRKSRC}/spamd.sh + post-install: @${STRIP_CMD} ${PREFIX}/bin/spamc - ${INSTALL_SCRIPT} ${FILESDIR}/spamd.sh ${PREFIX}/etc/rc.d/spamd.sh-dist + ${INSTALL_SCRIPT} ${WRKSRC}/spamd.sh ${PREFIX}/etc/rc.d/spamd${RC_SUFX} .if !defined(NOPORTDOCS) ${MKDIR} ${DOCSDIR} diff --git a/mail/p5-Mail-SpamAssassin/files/spamd.sh b/mail/p5-Mail-SpamAssassin/files/spamd.sh index b56cddfaadb5..f33aa9c1e20f 100644 --- a/mail/p5-Mail-SpamAssassin/files/spamd.sh +++ b/mail/p5-Mail-SpamAssassin/files/spamd.sh @@ -1,19 +1,41 @@ #!/bin/sh +# +# $FreeBSD$ +# -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi +# PROVIDE: spamd +# REQUIRE: LOGIN +# BEFORE: mail +# KEYWORD: FreeBSD shutdown -case "$1" in -start) - [ -x ${PREFIX}/bin/spamd ] && ${PREFIX}/bin/spamd -a -c -d && echo -n ' spamd' - ;; -stop) - ;; -*) - echo "Usage: `basename $0` {start|stop}" >&2 - ;; -esac +# +# Add the following lines to /etc/rc.conf to enable spamd: +# +#spamd_enable="YES" +# +# See spamd(8) for flags +# -exit 0 +. %%RC_SUBR%% + +name=spamd +rcvar=`set_rcvar` + +command=%%PREFIX%%/bin/spamd +pidfile=/var/run/spamd.pid +required_dirs=%%PREFIX%%/share/spamassassin + +stop_postcmd=stop_postcmd + +stop_postcmd() +{ + rm -f $pidfile +} + +# set defaults + +spamd_enable=${spamd_enable:-"NO"} +spamd_flags=${spamd_flags:-"-a -c -d -r ${pidfile}"} + +load_rc_config $name +run_rc_command "$1" diff --git a/mail/p5-Mail-SpamAssassin/pkg-plist b/mail/p5-Mail-SpamAssassin/pkg-plist index b327638b72a3..f34298b09c02 100644 --- a/mail/p5-Mail-SpamAssassin/pkg-plist +++ b/mail/p5-Mail-SpamAssassin/pkg-plist @@ -3,7 +3,7 @@ bin/spamassassin bin/spamc bin/spamd etc/mail/spamassassin/local.cf.sample -etc/rc.d/spamd.sh-dist +etc/rc.d/spamd%%RC_SUFX%% %%SITE_PERL%%/Mail/SpamAssassin.pm %%SITE_PERL%%/Mail/SpamAssassin/ArchiveIterator.pm %%SITE_PERL%%/Mail/SpamAssassin/AuditMessage.pm