ports/82151: [PATCH] mail/p5-Mail-SpamAssassin: install rcNG startup script to properly location
Petr Rehor
reho at rx.cz
Sat Jun 11 22:55:41 UTC 2005
diff -urN /usr/ports/mail/p5-Mail-SpamAssassin/Makefile Makefile
--- /usr/ports/mail/p5-Mail-SpamAssassin/Makefile Thu Jun 9 03:17:54 2005
+++ Makefile Sat Jun 11 22:37:20 2005
@@ -7,6 +7,7 @@
PORTNAME= Mail-SpamAssassin
PORTVERSION= 3.0.4
+PORTREVISION= 1
CATEGORIES= mail perl5
MASTER_SITES= ${MASTER_SITE_APACHE:S/$/:apache/} ${MASTER_SITE_PERL_CPAN:S/$/:cpan/}
MASTER_SITE_SUBDIR= spamassassin/source/:apache Mail/:cpan
@@ -34,6 +35,9 @@
SPF_QUERY "Add SPF query support" off \
TOOLS "Install SpamAssassin tools" off
+USE_REINPLACE= yes
+USE_RCORDER= sa-spamd.sh
+
.include <bsd.port.pre.mk>
.if defined(WITH_SPF_QUERY)
@@ -110,37 +114,31 @@
DOCSLDAP= README README.testing sa_test.ldif
PORTDOCS= ${DOCS} sql contrib ldap
-USE_RC_SUBR= yes
-SED_SCRIPT= -e 's|%%PREFIX%%|${PREFIX}|g' \
- -e 's|%%RC_SUBR%%|${RC_SUBR}|g'
.if defined(USE_SQLDB)
-SED_SCRIPT+= -e 's|%%SQL_FLAG%%|-Q|g'
+SUB_LIST+= SQL_FLAG="-Q"
.else
-SED_SCRIPT+= -e 's|%%SQL_FLAG%%||g'
+SUB_LIST+= SQL_FLAG=""
.endif
.if !defined(WITH_AS_ROOT)
-SED_SCRIPT+= -e 's|%%RUN_AS_USER%%|-u spamd -H /var/spool/spamd|g'
+SUB_LIST+= RUN_AS_USER="-u spamd -H /var/spool/spamd"
.else
-SED_SCRIPT+= -e 's|%%RUN_AS_USER%%||g'
+SUB_LIST+= RUN_AS_USER=""
.endif
+SED_SCRIPT= ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/}
+
post-patch:
@${FIND} ${WRKSRC} -name \*.orig -delete
- @${SED} -e 's#B_CONFDIR)/local.cf#B_CONFDIR)/local.cf.sample#g' \
+ @${REINPLACE_CMD} -e 's#B_CONFDIR)/local.cf#B_CONFDIR)/local.cf.sample#g' \
-e 's#B_CONFDIR)/init.pre#B_CONFDIR)/init.pre.sample#g' \
-e 's/require DBI/0/' \
- ${WRKSRC}/Makefile.PL > ${WRKSRC}/Makefile.PL.sed
- @${MV} ${WRKSRC}/Makefile.PL.sed ${WRKSRC}/Makefile.PL
-
-post-build:
- @${SED} ${SED_SCRIPT} ${FILESDIR}/spamd.sh > ${WRKDIR}/sa-spamd.sh
+ ${WRKSRC}/Makefile.PL
pre-install:
@${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
post-install:
@${STRIP_CMD} ${PREFIX}/bin/spamc
- @${INSTALL_SCRIPT} ${WRKDIR}/sa-spamd.sh ${PREFIX}/etc/rc.d/sa-spamd.sh
@[ -f ${PREFIX}/etc/mail/spamassassin/init.pre ] || \
${CP} ${PREFIX}/etc/mail/spamassassin/init.pre.sample \
${PREFIX}/etc/mail/spamassassin/init.pre
diff -urN /usr/ports/mail/p5-Mail-SpamAssassin/files/spamd.sh files/spamd.sh
--- /usr/ports/mail/p5-Mail-SpamAssassin/files/spamd.sh Tue May 17 04:04:13 2005
+++ files/spamd.sh Thu Jan 1 01:00:00 1970
@@ -1,41 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: ports/mail/p5-Mail-SpamAssassin/files/spamd.sh,v 1.11 2005/05/10 13:00:22 sem Exp $
-#
-
-# PROVIDE: spamd
-# REQUIRE: LOGIN
-# BEFORE: mail
-# KEYWORD: FreeBSD shutdown
-
-#
-# Add the following lines to /etc/rc.conf to enable spamd:
-#
-#spamd_enable="YES"
-#
-# See spamd(8) for flags
-#
-
-. %%RC_SUBR%%
-
-name=spamd
-rcvar=`set_rcvar`
-
-command=%%PREFIX%%/bin/spamd
-required_dirs=%%PREFIX%%/share/spamassassin
-
-stop_postcmd=stop_postcmd
-
-stop_postcmd()
-{
- rm -f $pidfile
-}
-
-# set defaults
-
-spamd_enable=${spamd_enable:-"NO"}
-spamd_pidfile=${spamd_pidfile:-"/var/run/spamd/spamd.pid"}
-spamd_flags=${spamd_flags:-"-c -d %%SQL_FLAG%% -r ${spamd_pidfile} %%RUN_AS_USER%%"}
-
-load_rc_config $name
-run_rc_command "$1"
diff -urN /dev/null files/sa-spamd.sh.in
--- /dev/null Thu Jan 1 01:00:00 1970
+++ files/sa-spamd.sh.in Wed Jun 8 23:41:36 2005
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: spamd
+# REQUIRE: LOGIN
+# BEFORE: mail
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable spamd:
+#
+#spamd_enable="YES"
+#
+# See spamd(8) for flags
+#
+
+# Set defaults
+spamd_enable="NO"
+spamd_pidfile="/var/run/spamd/spamd.pid"
+spamd_flags="-c -d %%SQL_FLAG%% -r ${spamd_pidfile} %%RUN_AS_USER%%"
+
+. %%RC_SUBR%%
+
+name=spamd
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/bin/spamd
+required_dirs=%%PREFIX%%/share/spamassassin
+
+stop_postcmd=stop_postcmd
+
+stop_postcmd()
+{
+ rm -f $pidfile
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff -urN /usr/ports/mail/p5-Mail-SpamAssassin/pkg-plist pkg-plist
--- /usr/ports/mail/p5-Mail-SpamAssassin/pkg-plist Tue May 17 04:04:13 2005
+++ pkg-plist Sat Jun 11 22:40:55 2005
@@ -1,4 +1,5 @@
- at unexec %D/etc/rc.d/sa-spamd.sh stop > /dev/null 2>&1 || true
+ at comment $FreeBSD$
+ at unexec %%RC_DIR%%/etc/rc.d/sa-spamd%%RC_SUFX%% stop > /dev/null 2>&1 || true
bin/sa-learn
bin/spamassassin
bin/spamc
@@ -7,7 +8,6 @@
@unexec if cmp -s %B/init.pre.sample %B/init.pre; then rm -f %B/init.pre; fi
etc/mail/spamassassin/init.pre.sample
@exec [ -f %B/init.pre ] || cp %B/%f %B/init.pre
-etc/rc.d/sa-spamd.sh
%%SITE_PERL%%/Mail/SpamAssassin.pm
%%SITE_PERL%%/Mail/SpamAssassin/ArchiveIterator.pm
%%SITE_PERL%%/Mail/SpamAssassin/AutoWhitelist.pm
More information about the freebsd-ports-bugs
mailing list