ports/126476: [update] net-mgmt/nrpe2: Update to 2.12; add 'reload' support

Andrei support at nolty.ru
Tue Aug 12 13:50:01 UTC 2008


>Number:         126476
>Category:       ports
>Synopsis:       [update] net-mgmt/nrpe2: Update to 2.12; add 'reload' support
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 12 13:50:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Andrei
>Release:        FreeBSD 7.0-RELEASE-p2
>Organization:
Nolty
>Environment:
FreeBSD nns.nolty.ru 7.0-RELEASE-p2 FreeBSD 7.0-RELEASE-p2 #1: Thu Jun 19 14:58:51 YEKST 2008     root at nns.nolty.ru:/usr/obj/usr/src/sys/NNS  i386
>Description:
Changes:
- Update to version 2.12.
- Add 'reload' support to rc script.
- Fix localstate permissions error on daemon stop command:
     "Cannot remove pidfile '/var/run/nrpe2.pid' - check your privileges."
- Delete files/patch-src-nrpe.c as it's already applied in 2.12.
- Fix pkg-deinstall. Delete notification about manually removeing /var/spool/nagios directory. nrpe2 never creates it;
- Fix pkg-install. Copy nrpe.cfg-sample to nrpe.cfg if not found.

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -ruN nrpe2.orig/Makefile nrpe2/Makefile
--- nrpe2.orig/Makefile	2008-06-06 19:53:04.000000000 +0600
+++ nrpe2/Makefile	2008-08-12 18:31:58.000000000 +0600
@@ -6,8 +6,7 @@
 #
 
 PORTNAME=	nrpe2
-PORTVERSION=	2.11
-PORTREVISION=	1
+PORTVERSION=	2.12
 CATEGORIES=	net-mgmt
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	nagios
@@ -29,6 +28,8 @@
 NAGIOSUSER?=	nagios
 NAGIOSGROUP?=	nagios
 NAGIOSDIR?=	/var/spool/nagios
+RUNDIR=		/var/run/nrpe2
+CONFFILE=	etc/nrpe.cfg
 
 NAGIOSUID=	181
 NAGIOSGID=	${NAGIOSUID}
@@ -36,16 +37,17 @@
 CONFIGURE_ARGS+=	--bindir=${PREFIX}/sbin \
 		--libexecdir=${PREFIX}/libexec/nagios \
 		--sysconfdir=${PREFIX}/etc \
+		--localstatedir=${RUNDIR} \
 		--with-nrpe-user=${NAGIOSUSER} \
 		--with-nrpe-group=${NAGIOSGROUP}
 
-PLIST_FILES=	sbin/nrpe2 etc/nrpe.cfg-sample libexec/nagios/check_nrpe2
-
 SUB_VARS=	NAGIOSDIR=${NAGIOSDIR} \
 		NAGIOSUSER=${NAGIOSUSER} \
 		NAGIOSGROUP=${NAGIOSGROUP} \
 		NAGIOSUID=${NAGIOSUID} \
-		NAGIOSGID=${NAGIOSGID}
+		NAGIOSGID=${NAGIOSGID} \
+		RUNDIR=${RUNDIR} \
+		CONFFILE=${CONFFILE}
 
 SUB_FILES=	pkg-install \
 		pkg-deinstall \
@@ -79,9 +81,10 @@
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/src/nrpe ${PREFIX}/sbin/nrpe2
 	${INSTALL_PROGRAM} ${WRKSRC}/src/check_nrpe ${PREFIX}/libexec/nagios/check_nrpe2
-	${INSTALL_DATA} ${WRKSRC}/sample-config/nrpe.cfg ${PREFIX}/etc/nrpe.cfg-sample
+	${INSTALL_DATA} ${WRKSRC}/sample-config/nrpe.cfg ${PREFIX}/${CONFFILE}-sample
 
 post-install:
+	@${SH} ${PKGINSTALL} ${DISTNAME} POST-INSTALL
 	@${CAT} ${PKGMESSAGE}
 
 .include <bsd.port.post.mk>
diff -ruN nrpe2.orig/distinfo nrpe2/distinfo
--- nrpe2.orig/distinfo	2008-02-21 00:18:36.000000000 +0500
+++ nrpe2/distinfo	2008-08-12 12:53:10.000000000 +0600
@@ -1,3 +1,3 @@
-MD5 (nrpe-2.11.tar.gz) = dcf3b7c5b7c94c0ba6cbb4999c1161f0
-SHA256 (nrpe-2.11.tar.gz) = 4cedfc2588ba65ebfe4e3310c9fbda08c6f0912cfcc2c1ac96636b6f5c839e1d
-SIZE (nrpe-2.11.tar.gz) = 405643
+MD5 (nrpe-2.12.tar.gz) = b2d75e2962f1e3151ef58794d60c9e97
+SHA256 (nrpe-2.12.tar.gz) = 7e8d093abef7d7ffc7219ad334823bdb612121df40de2dbaec9c6d0adeb04cfc
+SIZE (nrpe-2.12.tar.gz) = 405725
diff -ruN nrpe2.orig/files/nrpe2.in nrpe2/files/nrpe2.in
--- nrpe2.orig/files/nrpe2.in	2007-07-24 18:57:40.000000000 +0600
+++ nrpe2/files/nrpe2.in	2008-08-12 18:26:17.000000000 +0600
@@ -20,9 +20,11 @@
 rcvar=`set_rcvar`
 
 command="%%PREFIX%%/sbin/nrpe2"
-required_files=%%PREFIX%%/etc/nrpe.cfg
+required_files=%%PREFIX%%/%%CONFFILE%%
 command_args="-c ${required_files} -d"
-pidfile=/var/run/${name}.pid
+extra_commands="reload"
+sig_reload=HUP
+pidfile=%%RUNDIR%%/${name}.pid
 
 # set defaults
 
diff -ruN nrpe2.orig/files/patch-sample-config-nrpe.cfg.in nrpe2/files/patch-sample-config-nrpe.cfg.in
--- nrpe2.orig/files/patch-sample-config-nrpe.cfg.in	2008-06-23 02:17:32.000000000 +0600
+++ nrpe2/files/patch-sample-config-nrpe.cfg.in	2008-08-12 17:39:56.000000000 +0600
@@ -5,7 +5,7 @@
  # user and is running in standalone mode.
 
 -pid_file=/var/run/nrpe.pid
-+pid_file=/var/run/nrpe2/nrpe2.pid
++pid_file=@localstatedir@/nrpe2.pid
 
 
 
diff -ruN nrpe2.orig/files/patch-src-nrpe.c nrpe2/files/patch-src-nrpe.c
--- nrpe2.orig/files/patch-src-nrpe.c	2008-02-21 00:18:37.000000000 +0500
+++ nrpe2/files/patch-src-nrpe.c	1970-01-01 05:00:00.000000000 +0500
@@ -1,15 +0,0 @@
---- src/nrpe.c.orig	2007-12-27 05:55:05.000000000 +1030
-+++ src/nrpe.c	2008-02-20 19:19:03.000000000 +1030
-@@ -1458,8 +1458,10 @@
- 		                }while(bytes_read==-1 && errno==EINTR);
- 		        }
- 
--		if(bytes_read==-1 && output!=NULL)
--			strcpy(output,"");
-+			if(bytes_read==-1)
-+				*output='\0';
-+			else
-+				output[bytes_read]='\0';
- 
- 		/* if there was a critical return code and no output AND the command time exceeded the timeout thresholds, assume a timeout */
- 		if(result==STATE_CRITICAL && bytes_read==-1 && (end_time-start_time)>=timeout){
diff -ruN nrpe2.orig/files/pkg-deinstall.in nrpe2/files/pkg-deinstall.in
--- nrpe2.orig/files/pkg-deinstall.in	2007-07-24 18:57:40.000000000 +0600
+++ nrpe2/files/pkg-deinstall.in	2008-08-12 14:57:07.000000000 +0600
@@ -15,8 +15,4 @@
   if /usr/sbin/pw user show "${NAGIOSUSER}" 2>&1 >/dev/null; then
     echo "You should manually remove the \"${NAGIOSUSER}\" user."
   fi
-
-  if [ -e "${NAGIOSDIR}" ]; then
-    echo "You should manually remove the \"${NAGIOSDIR}\" directory."
-  fi
 fi
diff -ruN nrpe2.orig/files/pkg-install.in nrpe2/files/pkg-install.in
--- nrpe2.orig/files/pkg-install.in	2007-07-24 18:57:40.000000000 +0600
+++ nrpe2/files/pkg-install.in	2008-08-12 18:09:40.000000000 +0600
@@ -8,6 +8,8 @@
 NAGIOSGROUP=%%NAGIOSGROUP%%
 NAGIOSUID=%%NAGIOSUID%%
 NAGIOSGID=%%NAGIOSGID%%
+RUNDIR=%%RUNDIR%%
+CONFFILE=%%PREFIX%%/%%CONFFILE%%
 
 ask() {
   local question default answer
@@ -71,4 +73,13 @@
       exit 1
     fi
   fi
+elif [ "$2" = "POST-INSTALL" ]; then
+  if [ ! -e ${CONFFILE} ]; then
+    /bin/cp ${CONFFILE}-sample ${CONFFILE}
+    /bin/chmod 644 ${CONFFILE}
+  fi
+  if [ ! -e ${RUNDIR} ]; then
+    /bin/mkdir -m 755 ${RUNDIR}
+    /usr/sbin/chown ${NAGIOSUSER}:${NAGIOSGROUP} ${RUNDIR}
+  fi
 fi
diff -ruN nrpe2.orig/pkg-plist nrpe2/pkg-plist
--- nrpe2.orig/pkg-plist	1970-01-01 05:00:00.000000000 +0500
+++ nrpe2/pkg-plist	2008-08-12 18:23:21.000000000 +0600
@@ -0,0 +1,6 @@
+sbin/nrpe2
+libexec/nagios/check_nrpe2
+ at unexec if cmp -s %D/%%CONFFILE%% %D/%%CONFFILE%%-sample; then rm -f %D/%%CONFFILE%%; fi
+%%CONFFILE%%-sample
+ at exec [ -f %D/%%CONFFILE%% ] || cp %F %D/%%CONFFILE%%
+ at unexec rmdir %%RUNDIR%%


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list