Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Sep 2012 20:57:28 +0000 (UTC)
From:      Chris Rees <crees@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r304163 - in head/net-mgmt/nrpe2: . files
Message-ID:  <201209122057.q8CKvSP8046722@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: crees
Date: Wed Sep 12 20:57:27 2012
New Revision: 304163
URL: http://svn.freebsd.org/changeset/ports/304163

Log:
  Improve rc script handling of pidfile, and do a few optimisations
  
  PR:		ports/168225
  Submitted by:	yar (based on)
  
  While here, copy over default config file on install

Modified:
  head/net-mgmt/nrpe2/Makefile
  head/net-mgmt/nrpe2/files/nrpe2.in
  head/net-mgmt/nrpe2/pkg-plist

Modified: head/net-mgmt/nrpe2/Makefile
==============================================================================
--- head/net-mgmt/nrpe2/Makefile	Wed Sep 12 20:39:39 2012	(r304162)
+++ head/net-mgmt/nrpe2/Makefile	Wed Sep 12 20:57:27 2012	(r304163)
@@ -74,7 +74,7 @@ CONFIGURE_ARGS+=	--disable-command-args
 .endif
 
 post-patch:
-	@${REINPLACE_CMD} -e 's#/var/run/nrpe.pid#@localstatedir@/nrpe2.pid#g' \
+	@${REINPLACE_CMD} -e 's#/var/run/nrpe.pid#/var/run/nrpe2/nrpe2.pid#g' \
 		-e 's#/usr/lib/nagios/plugins/#${LOCALBASE}/libexec/nagios/#g' \
 		-e 's#/usr/bin/sudo#${LOCALBASE}/bin/sudo#g' \
 		${WRKSRC}/sample-config/nrpe.cfg.in
@@ -90,6 +90,8 @@ do-install:
 
 post-install:
 	@${SH} ${PKGINSTALL} ${DISTNAME} POST-INSTALL
+	@[ -f ${PREFIX}/etc/nrpe.cfg ] || \
+	    ${CP} -p ${PREFIX}/etc/nrpe.cfg-sample ${PREFIX}/etc/nrpe.cfg
 	@${CAT} ${PKGMESSAGE}
 
 .include <bsd.port.post.mk>

Modified: head/net-mgmt/nrpe2/files/nrpe2.in
==============================================================================
--- head/net-mgmt/nrpe2/files/nrpe2.in	Wed Sep 12 20:39:39 2012	(r304162)
+++ head/net-mgmt/nrpe2/files/nrpe2.in	Wed Sep 12 20:57:27 2012	(r304163)
@@ -21,20 +21,18 @@
 name="nrpe2"
 rcvar=nrpe2_enable
 
+: ${nrpe2_enable=NO}
+: ${nrpe2_configfile=%%PREFIX%%/etc/nrpe.cfg}
+pidfile=${nrpe2_pidfile:-/var/run/nrpe2/nrpe2.pid}
+
 command="%%PREFIX%%/sbin/nrpe2"
 command_args="-d"
 extra_commands="reload"
-
+start_precmd="install -d -o ${nrpe_user:-nagios} ${pidfile%/*}"
 sig_reload=HUP
 
-[ -z "${nrpe2_enable}" ] && nrpe2_enable="NO"
-[ -z "${nrpe2_configfile}" ] && nrpe2_configfile="%%PREFIX%%/etc/nrpe.cfg"
-[ -z "${nrpe2_pidfile}" ] && nrpe2_pidfile="%%NAGIOSDIR%%/nrpe2.pid"
-
 load_rc_config "${name}"
 
-pidfile="${nrpe2_pidfile}"
-
 required_files="${nrpe2_configfile}"
 command_args="${command_args} -c ${nrpe2_configfile}"
 

Modified: head/net-mgmt/nrpe2/pkg-plist
==============================================================================
--- head/net-mgmt/nrpe2/pkg-plist	Wed Sep 12 20:39:39 2012	(r304162)
+++ head/net-mgmt/nrpe2/pkg-plist	Wed Sep 12 20:57:27 2012	(r304163)
@@ -1,4 +1,6 @@
+@unexec cmp -s %D/etc/nrpe.cfg-sample %D/etc/nrpe.cfg && rm %D/etc/nrpe.cfg || true
 etc/nrpe.cfg-sample
+@exec test -f %B/nrpe.cfg || cp -p %D/%F %B/nrpe.cfg
 libexec/nagios/check_nrpe2
 @dirrmtry libexec/nagios
 sbin/nrpe2



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