aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt
diff options
context:
space:
mode:
authorcrees <crees@FreeBSD.org>2012-09-13 04:57:27 +0800
committercrees <crees@FreeBSD.org>2012-09-13 04:57:27 +0800
commitb6e49e127628a2d2f424ad45285e56e359ded161 (patch)
treef9f93b50fdf17cac03c05f6febdae353fb41d4fa /net-mgmt
parent6e4fed8e07de0e09103e4159f775f45b0af79016 (diff)
downloadfreebsd-ports-gnome-b6e49e127628a2d2f424ad45285e56e359ded161.tar.gz
freebsd-ports-gnome-b6e49e127628a2d2f424ad45285e56e359ded161.tar.zst
freebsd-ports-gnome-b6e49e127628a2d2f424ad45285e56e359ded161.zip
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
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/nrpe2/Makefile4
-rw-r--r--net-mgmt/nrpe2/files/nrpe2.in12
-rw-r--r--net-mgmt/nrpe2/pkg-plist2
3 files changed, 10 insertions, 8 deletions
diff --git a/net-mgmt/nrpe2/Makefile b/net-mgmt/nrpe2/Makefile
index cc4ed0a6b493..6675b911db0c 100644
--- a/net-mgmt/nrpe2/Makefile
+++ b/net-mgmt/nrpe2/Makefile
@@ -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>
diff --git a/net-mgmt/nrpe2/files/nrpe2.in b/net-mgmt/nrpe2/files/nrpe2.in
index ec291bc00acc..61d861fde7d5 100644
--- a/net-mgmt/nrpe2/files/nrpe2.in
+++ b/net-mgmt/nrpe2/files/nrpe2.in
@@ -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}"
diff --git a/net-mgmt/nrpe2/pkg-plist b/net-mgmt/nrpe2/pkg-plist
index 2b1e9a928c2f..dbd317620084 100644
--- a/net-mgmt/nrpe2/pkg-plist
+++ b/net-mgmt/nrpe2/pkg-plist
@@ -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