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
This commit is contained in:
Chris Rees 2012-09-12 20:57:27 +00:00
parent 6d815e2e8f
commit 62abc9a9fc
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=304163
3 changed files with 10 additions and 8 deletions

View File

@ -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>

View File

@ -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}"

View File

@ -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