Skip site navigation (1)Skip section navigation (2)
Date:      Sun,  7 Nov 2004 12:00:40 +1100 (EST)
From:      Edwin Groothuis <edwin@mavetju.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        paul@nerdlabs.com
Subject:   ports/73632: [patch] support of rc_subr for net-mgmt/nrpe
Message-ID:  <20041107010040.288EA60E5@k7.mavetju>
Resent-Message-ID: <200411070110.iA71AQJo088853@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         73632
>Category:       ports
>Synopsis:       [patch] support of rc_subr for net-mgmt/nrpe
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 07 01:10:26 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Edwin Groothuis
>Release:        FreeBSD 5.2.1-RELEASE i386
>Organization:
-
>Environment:
System: FreeBSD k7.mavetju 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #7: Tue Sep 21 23:13:39 EST 2004 root@k7.mavetju:/usr/src-5.2.1/sys/i386/compile/k7 i386

>Description:

This patch will add rc_subr support for net-mgmt/nrpe

>How-To-Repeat:
>Fix:

Two new files: files/nrpe.sh and pkg-message

Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/net-mgmt/nrpe/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- Makefile	30 May 2004 09:11:35 -0000	1.10
+++ Makefile	7 Nov 2004 00:55:58 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	nrpe
 PORTVERSION=	1.9
-PORTREVISION=	0
+PORTREVISION=	1
 CATEGORIES=	net-mgmt
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	nagios
@@ -19,14 +19,28 @@
 
 GNU_CONFIGURE=	yes
 USE_PERL5=	yes
+USE_REINPLACE=	yes
+USE_RC_SUBR=	yes
+RC_SCRIPTS_SUB=	PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
 
 CONFIGURE_ARGS=	--libexecdir=${PREFIX}/libexec/nagios --sysconfdir=${PREFIX}/etc \
 		--sbindir=${PREFIX}/sbin --bindir=${PREFIX}/sbin
 
+post-patch:
+	${CP} ${FILESDIR}/nrpe.sh ${WRKDIR}/nrpe.sh
+	${REINPLACE_CMD} \
+		-e 's,%%PREFIX%%,${PREFIX},g' \
+		-e 's,%%RC_SUBR%%,${RC_SUBR},g' \
+		${WRKDIR}/nrpe.sh
+
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/src/nrpe ${PREFIX}/sbin/nrpe
-	${INSTALL_PROGRAM} ${WRKSRC}/src/check_nrpe ${PREFIX}/libexec/nagios/check_nrpe
+	${INSTALL_PROGRAM} ${WRKSRC}/src/check_nrpe \
+		${PREFIX}/libexec/nagios/check_nrpe
 	${INSTALL_DATA} ${WRKSRC}/nrpe.cfg ${PREFIX}/etc/nrpe.cfg-sample
-	${INSTALL_SCRIPT} ${WRKSRC}/init-script.freebsd ${PREFIX}/etc/rc.d/nrpe.sh
+	${INSTALL_SCRIPT} ${WRKDIR}/nrpe.sh ${PREFIX}/etc/rc.d/nrpe.sh
+
+post-install:
+	${CAT} ${PKGMESSAGE}
 
 .include <bsd.port.mk>
Index: pkg-message
===================================================================
RCS file: pkg-message
diff -N pkg-message
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pkg-message	7 Nov 2004 00:55:58 -0000
@@ -0,0 +1,5 @@
+*************************************************************************
+Available variables you add/set to /etc/rc.conf:
+- nrpe_enable (bool):	Set to "NO" by default
+- nrpe_config (string):	Set to ${PREFIX}/etc/nrpe.cfg by default
+*************************************************************************
Index: files/nrpe.sh
===================================================================
RCS file: files/nrpe.sh
diff -N files/nrpe.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/nrpe.sh	7 Nov 2004 00:55:58 -0000
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+#
+# Add the following lines to /etc/rc.conf to enable apache2:
+# nrpe_enable (bool):	Set to "NO" by default.
+#			Set it to "YES" to enable nrpe
+# nrpe_config (string):	Set to "/usr/local/etc/nrpe.cfg" by default.
+#
+
+. %%RC_SUBR%%
+
+name="nrpe"
+rcvar=`set_rcvar`
+
+command="%%PREFIX%%/bin/nrpe"
+
+[ -z "$nrpe_enable" ]	&& nrpe_enable="NO"
+[ -z "$nrpe_config" ]	&& nrpe_config="%%PREFIX%%/etc/nrpe.cfg"
+
+nrpe_flags="-d ${nrpe_config}"
+
+load_rc_config $name
+
+run_rc_command "$1"
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041107010040.288EA60E5>