aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt
diff options
context:
space:
mode:
authoredwin <edwin@FreeBSD.org>2006-01-09 08:54:01 +0800
committeredwin <edwin@FreeBSD.org>2006-01-09 08:54:01 +0800
commit2badcaf76235d1844d01c3fb27e502924e03a15d (patch)
treed519f52ec16a3deed66bb8c3b330f7abf4bda980 /net-mgmt
parente21cc09526f470922e85e3c0797a974b3d616a3b (diff)
downloadfreebsd-ports-gnome-2badcaf76235d1844d01c3fb27e502924e03a15d.tar.gz
freebsd-ports-gnome-2badcaf76235d1844d01c3fb27e502924e03a15d.tar.zst
freebsd-ports-gnome-2badcaf76235d1844d01c3fb27e502924e03a15d.zip
[maintainer-update] net-mgmt/nagios: Update to 2.0.r1
Update to 2.0.r1 also includes: - Rewrite of port Makefile, options closer aligned in order to bsd.port.mk - Added dependency of libiconv (library required by CGI's, currently installed via nagios-plugins port) - Added support for embedded Perl interpreter (requires Perl 5.8+), caching automatically assumed if enabled, off by default - Added support for use of nanosleep() in event timings, off by default - Added ability to override default view at http://webserver/nagios/ URL, suggested values listed in Makefile (validity after future Nagios releases not guaranteed) - Default install location for web component moved to www/nagios, overridable using existing NAGIOSWWWDIR tunable - Corrected minor build issues by tweaking use of CFLAGS - Moved pkg-install, pkg-deinstall and pkg-message into SUB_FILES - Added configuration file tunable (nagios_configfile) for /etc/rc.conf - Configuration tests now show error on failure instead of command to run - Host status (status.sav) now saved across application starts and restarts - Added patch to correct PERL_SYS_INIT3 call in base/utils.c, patch supplied and tested by Karl Friesen <krf@splip.com>, thanks! - Added Apache configuration suggestion in pkg-message for new installs Files changed: - ports/net-mgmt/nagios/Makefile - ports/net-mgmt/nagios/distinfo - ports/net-mgmt/nagios/files/patch-Makefile.in - ports/net-mgmt/nagios/pkg-plist Files created: - ports/net-mgmt/nagios/files/nagios.sh.in - ports/net-mgmt/nagios/files/patch-base-utils.c - ports/net-mgmt/nagios/files/patch-contrib-Makefile.in - ports/net-mgmt/nagios/files/pkg-deinstall.in - ports/net-mgmt/nagios/files/pkg-install.in - ports/net-mgmt/nagios/files/pkg-message.in Files to be removed: - ports/net-mgmt/nagios/files/DEINSTALL.tmpl - ports/net-mgmt/nagios/files/INSTALL.tmpl - ports/net-mgmt/nagios/files/MESSAGE.tmpl - ports/net-mgmt/nagios/files/nagios.sh.tmpl PR: ports/91499 Submitted by: Jarrod Sayers <jarrod@netleader.com.au>
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/nagios/Makefile120
-rw-r--r--net-mgmt/nagios/distinfo4
-rw-r--r--net-mgmt/nagios/files/DEINSTALL.tmpl23
-rw-r--r--net-mgmt/nagios/files/INSTALL.tmpl67
-rw-r--r--net-mgmt/nagios/files/MESSAGE.tmpl15
-rw-r--r--net-mgmt/nagios/files/nagios.sh.in62
-rw-r--r--net-mgmt/nagios/files/nagios.sh.tmpl71
-rw-r--r--net-mgmt/nagios/files/patch-Makefile.in13
-rw-r--r--net-mgmt/nagios/files/patch-base-utils.c11
-rw-r--r--net-mgmt/nagios/files/patch-contrib-Makefile.in17
-rw-r--r--net-mgmt/nagios/files/pkg-deinstall.in22
-rw-r--r--net-mgmt/nagios/files/pkg-install.in69
-rw-r--r--net-mgmt/nagios/files/pkg-message.in29
-rw-r--r--net-mgmt/nagios/pkg-plist1
-rw-r--r--net-mgmt/nagios2/Makefile120
-rw-r--r--net-mgmt/nagios2/distinfo4
-rw-r--r--net-mgmt/nagios2/files/DEINSTALL.tmpl23
-rw-r--r--net-mgmt/nagios2/files/INSTALL.tmpl67
-rw-r--r--net-mgmt/nagios2/files/MESSAGE.tmpl15
-rw-r--r--net-mgmt/nagios2/files/nagios.sh.in62
-rw-r--r--net-mgmt/nagios2/files/nagios.sh.tmpl71
-rw-r--r--net-mgmt/nagios2/files/patch-Makefile.in13
-rw-r--r--net-mgmt/nagios2/files/patch-base-utils.c11
-rw-r--r--net-mgmt/nagios2/files/patch-contrib-Makefile.in17
-rw-r--r--net-mgmt/nagios2/files/pkg-deinstall.in22
-rw-r--r--net-mgmt/nagios2/files/pkg-install.in69
-rw-r--r--net-mgmt/nagios2/files/pkg-message.in29
-rw-r--r--net-mgmt/nagios2/pkg-plist1
28 files changed, 560 insertions, 488 deletions
diff --git a/net-mgmt/nagios/Makefile b/net-mgmt/nagios/Makefile
index 995668484228..33f6e163cf8d 100644
--- a/net-mgmt/nagios/Makefile
+++ b/net-mgmt/nagios/Makefile
@@ -6,11 +6,11 @@
#
PORTNAME= nagios
-PORTVERSION= 2.0.b6
+PORTVERSION= 2.0.r1
+DISTVERSION= 2.0rc1
CATEGORIES= net-mgmt
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
-MASTER_SITE_SUBDIR=nagios
-DISTNAME= nagios-2.0b6
+MASTER_SITE_SUBDIR= nagios
MAINTAINER= jarrod@netleader.com.au
COMMENT= Extremely powerful network monitoring system
@@ -18,40 +18,39 @@ COMMENT= Extremely powerful network monitoring system
LIB_DEPENDS= gd.4:${PORTSDIR}/graphics/gd
RUN_DEPENDS= ${LOCALBASE}/libexec/nagios/check_nagios:${PORTSDIR}/net-mgmt/nagios-plugins
-USE_GETOPT_LONG=yes
-GNU_CONFIGURE= yes
+USE_GETOPT_LONG= yes
+USE_ICONV= yes
+USE_PERL5_BUILD= yes
USE_AUTOTOOLS= autoconf:259
-USE_RC_SUBR= yes
-USE_PERL5_BUILD=yes
+USE_RC_SUBR= nagios.sh
+USE_REINPLACE= yes
+
+OPTIONS= EMBEDDED_PERL "Enable embedded Perl [requires Perl 5.8+]" OFF \
+ NANOSLEEP "Use nanosleep in event timing" OFF
-PKGINSTALL= ${WRKDIR}/INSTALL
-PKGDEINSTALL= ${WRKDIR}/DEINSTALL
-PKGMESSAGE= ${WRKDIR}/MESSAGE
+GNU_CONFIGURE= yes
NAGIOSUSER?= nagios
NAGIOSGROUP?= nagios
NAGIOSDIR?= /var/spool/nagios
+NAGIOSWWWDIR?= www/nagios
NAGIOSHTMURL?= /nagios
NAGIOSCGIURL?= ${NAGIOSHTMURL}/cgi-bin
-.if defined(NAGIOSWWWDIR) || defined(WITH_NAGIOS_WWWDIR)
-NAGIOSWWWDIRSET=yes
-.endif
-
-.if defined(WITH_NAGIOS_WWWDIR) && !defined(NAGIOSWWWDIR)
-NAGIOSWWWDIR= www/nagios
-.else
-NAGIOSWWWDIR?= share/nagios
-.endif
+# Suggested NAGIOSHOMEURL values:
+# Home: main.html
+# Tactical Overview: ${NAGIOSCGIURL}/tac.cgi
+# Service Detail: ${NAGIOSCGIURL}/status.cgi?host=all
+# Host Detail: ${NAGIOSCGIURL}/status.cgi?hostgroup=all&style=hostdetail
+# Status Map: ${NAGIOSCGIURL}/statusmap.cgi?host=all
+NAGIOSHOMEURL?= main.html
.include <bsd.port.pre.mk>
CPPFLAGS= -I${LOCALBASE}/include -fPIC
-CONFIGURE_ENV= CPPFLAGS="${CPPFLAGS}" \
- LDFLAGS="${LDFLAGS}" \
- CFLAGS="${CPPFLAGS} ${CFLAGS}" \
- LIBS="-L${LOCALBASE}/lib -lgd"
+CFLAGS+= ${CPPFLAGS}
+
CONFIGURE_ARGS= --with-command-user=${NAGIOSUSER} \
--with-command-group=${WWWGRP} \
--with-nagios-user=${NAGIOSUSER} \
@@ -65,60 +64,53 @@ CONFIGURE_ARGS= --with-command-user=${NAGIOSUSER} \
--localstatedir=${NAGIOSDIR} \
--prefix=${PREFIX}
+CONFIGURE_ENV= CPPFLAGS="${CPPFLAGS}" \
+ CFLAGS="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ LIBS="-L${LOCALBASE}/lib" \
+ PERL=${PERL}
+
+INSTALL_TARGET= install install-commandmode install-config
+
PLIST_SUB= NAGIOSDIR=${NAGIOSDIR} \
NAGIOSWWWDIR=${NAGIOSWWWDIR} \
NAGIOSUSER=${NAGIOSUSER} \
NAGIOSGROUP=${NAGIOSGROUP} \
+ NAGIOSHTMURL=${NAGIOSHTMURL} \
+ NAGIOSCGIURL=${NAGIOSCGIURL} \
WWWGRP=${WWWGRP}
-SED_SCRIPT= -e 's,%%NAGIOSUSER%%,${NAGIOSUSER},g' \
- -e 's,%%NAGIOSGROUP%%,${NAGIOSGROUP},g' \
- -e 's,%%NAGIOSDIR%%,${NAGIOSDIR},g' \
- -e 's,%%NAGIOSWWWDIR%%,${NAGIOSWWWDIR},g' \
- -e 's,%%PREFIX%%,${PREFIX},g' \
- -e 's,%%RC_SUBR%%,${RC_SUBR},g'
-
-INSTALL_TARGET= all install config install-config install-commandmode
-
-pre-everything::
-.if !defined(NAGIOSWWWDIRSET)
- @${ECHO_CMD} "**********************************************************************"
- @${ECHO_CMD} ""
- @${ECHO_CMD} " The web component of this port is currently being installed under"
- @${ECHO_CMD} " ${PREFIX}/${NAGIOSWWWDIR}, the default for which is being changed"
- @${ECHO_CMD} " when Nagios 2.0 is released. If this is a new installation, please"
- @${ECHO_CMD} " consider adding the following option to /etc/make.conf to install the"
- @${ECHO_CMD} " component under the correct home of ${PREFIX}/www/nagios:"
- @${ECHO_CMD} ""
- @${ECHO_CMD} " # net-mgmt/nagios"
- @${ECHO_CMD} " WITH_NAGIOS_WWWDIR=YES"
- @${ECHO_CMD} ""
- @${ECHO_CMD} " Existing installations can be upgraded with this option with only"
- @${ECHO_CMD} " minor changes being required to etc/apache[2]/httpd.conf to change"
- @${ECHO_CMD} " references of ${PREFIX}/${NAGIOSWWWDIR} to ${PREFIX}/www/nagios."
- @${ECHO_CMD} ""
- @${ECHO_CMD} " Should you wish to continue using ${PREFIX}/${NAGIOSWWWDIR}, define"
- @${ECHO_CMD} " the NAGIOSWWWDIR variable without the ${PREFIX}/ prefix:"
- @${ECHO_CMD} ""
- @${ECHO_CMD} " # net-mgmt/nagios"
- @${ECHO_CMD} " NAGIOSWWWDIR=${NAGIOSWWWDIR}"
- @${ECHO_CMD} ""
- @${ECHO_CMD} " The WITH_NAGIOS_WWWDIR knob will vanish once the default has been"
- @${ECHO_CMD} " changed and the NAGIOSWWWDIR tunable option will remain permanently."
- @${ECHO_CMD} ""
- @${ECHO_CMD} "**********************************************************************"
+SUB_FILES= pkg-install \
+ pkg-deinstall \
+ pkg-message
+
+SUB_LIST= PREFIX=${PREFIX} \
+ ${PLIST_SUB}
+
+.if defined(WITH_EMBEDDED_PERL)
+.if ${PERL_LEVEL} >= 500800
+USE_PERL5= yes
+CONFIGURE_ARGS+= --enable-embedded-perl \
+ --with-perlcache
+.else
+IGNORE= "Embedded Perl requires Perl 5.8 or higher (see lang/perl5.8)"
+.endif
+PLIST_SUB+= EMBEDDED_PERL=""
+.else
+PLIST_SUB+= EMBEDDED_PERL="@comment "
+.endif
+
+.if defined(WITH_NANOSLEEP)
+CONFIGURE_ARGS+= --enable-nanosleep
.endif
-pre-build:
- for myfile in nagios.sh INSTALL DEINSTALL MESSAGE; do \
- ${SED} ${SED_SCRIPT} < ${FILESDIR}/$${myfile}.tmpl >${WRKDIR}/$${myfile}; \
- done
+post-patch:
+ ${REINPLACE_CMD} -e 's#"main.html"#"${NAGIOSHOMEURL:S/\//\\\//g:S/&/\\&/g}"#' ${WRKSRC}/html/index.html.in
pre-install:
@${SH} ${PKGINSTALL} ${DISTNAME} PRE-INSTALL
post-install:
- @${INSTALL_SCRIPT} ${WRKDIR}/nagios.sh ${PREFIX}/etc/rc.d/
@${CHMOD} 775 ${NAGIOSDIR} ${NAGIOSDIR}/archives ${NAGIOSDIR}/rw
@${CHOWN} ${NAGIOSUSER}:${NAGIOSGROUP} ${NAGIOSDIR} ${NAGIOSDIR}/archives
@${CHOWN} ${NAGIOSUSER}:${WWWGRP} ${NAGIOSDIR}/rw
diff --git a/net-mgmt/nagios/distinfo b/net-mgmt/nagios/distinfo
index 0e83ee5c1b5e..11d38ba18279 100644
--- a/net-mgmt/nagios/distinfo
+++ b/net-mgmt/nagios/distinfo
@@ -1,2 +1,2 @@
-MD5 (nagios-2.0b6.tar.gz) = c4a08697f852b0d535bf34fff0bf8b1f
-SIZE (nagios-2.0b6.tar.gz) = 1728173
+MD5 (nagios-2.0rc1.tar.gz) = 5807fc2f1cf5355a2eadc6f4d51f6711
+SIZE (nagios-2.0rc1.tar.gz) = 1731687
diff --git a/net-mgmt/nagios/files/DEINSTALL.tmpl b/net-mgmt/nagios/files/DEINSTALL.tmpl
deleted file mode 100644
index 93ed52b4d017..000000000000
--- a/net-mgmt/nagios/files/DEINSTALL.tmpl
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-
-USER=%%NAGIOSUSER%%
-GROUP=%%NAGIOSGROUP%%
-DIR=%%NAGIOSDIR%%
-
-if [ "$2" = "POST-DEINSTALL" ]; then
-
- if /usr/sbin/pw group show "${GROUP}" 2>&1 >/dev/null; then
- echo "You should manually remove the \"${GROUP}\" group."
- fi
-
- if /usr/sbin/pw user show "${USER}" 2>&1 >/dev/null; then
- echo "You should manually remove the \"${USER}\" user."
- fi
-
- if [ -e ${DIR} ]; then
- echo "You should manually remove the \"${DIR}\" directory."
- fi
-fi
diff --git a/net-mgmt/nagios/files/INSTALL.tmpl b/net-mgmt/nagios/files/INSTALL.tmpl
deleted file mode 100644
index da8b7ef5e100..000000000000
--- a/net-mgmt/nagios/files/INSTALL.tmpl
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: /tmp/pcvs/ports/net-mgmt/nagios/files/Attic/INSTALL.tmpl,v 1.1 2004-02-11 04:56:00 linimon Exp $
-#
-
-USER=%%NAGIOSUSER%%
-GROUP=%%NAGIOSGROUP%%
-DIR=%%NAGIOSDIR%%
-
-ask() {
- local question default answer
-
- question=$1
- default=$2
- if [ -z "${PACKAGE_BUILDING}" ]; then
- read -p "${question} [${default}]? " answer
- fi
- if [ x${answer} = x ]; then
- answer=${default}
- fi
- echo ${answer}
-}
-
-yesno() {
- local dflt question answer
-
- question=$1
- dflt=$2
- while :; do
- answer=$(ask "${question}" "${dflt}")
- case "${answer}" in
- [Yy]*) return 0;;
- [Nn]*) return 1;;
- esac
- echo "Please answer yes or no."
- done
-}
-
-if [ x"$2" = xPRE-INSTALL ]; then
- if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then
- echo "You already have a group \"${GROUP}\", so I will use it."
- else
- echo "You need a group \"${GROUP}\"."
- if yesno "Would you like me to create it" y; then
- /usr/sbin/pw groupadd ${GROUP} -h - || exit
- echo "Done."
- else
- echo "Please create it, and try again."
- exit 1
- fi
- fi
-
- if /usr/sbin/pw user show "${USER}" 2>/dev/null; then
- echo "You already have a user \"${USER}\", so I will use it."
- else
- echo "You need a user \"${USER}\"."
- if yesno "Would you like me to create it" y; then
- /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - -d ${DIR} \
- -s /nonexistent -c "Nagios pseudo-user" || exit
- echo "Done."
- else
- echo "Please create it, and try again."
- exit 1
- fi
- fi
-
-fi
diff --git a/net-mgmt/nagios/files/MESSAGE.tmpl b/net-mgmt/nagios/files/MESSAGE.tmpl
deleted file mode 100644
index 234bb9c24189..000000000000
--- a/net-mgmt/nagios/files/MESSAGE.tmpl
+++ /dev/null
@@ -1,15 +0,0 @@
-
-*******************************************************************
- Enable nagios in /etc/rc.conf with the following line:
-
- nagios_enable="YES"
-
- Configuration templates are available in %%PREFIX%%/etc/nagios
- as *.cfg-sample files. Copy them to *.cfg and edit them to suit
- your needs. Documentation is available in HTML form in
- %%PREFIX%%/%%NAGIOSWWWDIR%%/docs.
-
- If you don't already have a web server running, you need to install
- and configure it to finish your nagios installation.
-*******************************************************************
-
diff --git a/net-mgmt/nagios/files/nagios.sh.in b/net-mgmt/nagios/files/nagios.sh.in
new file mode 100644
index 000000000000..03207c926b44
--- /dev/null
+++ b/net-mgmt/nagios/files/nagios.sh.in
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+#
+# Add the following lines to /etc/rc.conf to enable nagios:
+# nagios_enable (bool): Set to "NO" by default.
+# Set it to "YES" to enable nagios.
+# nagios_flags (str): Set to "" by default.
+# nagios_configfile (str): Set to "%%PREFIX%%/etc/nagios/nagios.cfg" by default.
+#
+
+. %%RC_SUBR%%
+
+name="nagios"
+rcvar=`set_rcvar`
+
+command="%%PREFIX%%/bin/nagios"
+command_args="-d"
+pidfile="%%NAGIOSDIR%%/nagios.lock"
+nagios_user="%%NAGIOSUSER%%"
+
+start_precmd="start_precmd"
+stop_postcmd="stop_postcmd"
+restart_precmd="nagios_checkconfig"
+
+[ -z "${nagios_enable}" ] && nagios_enable="NO"
+[ -z "${nagios_flags}" ] && nagios_flags=""
+[ -z "${nagios_configfile}" ] && nagios_configfile="%%PREFIX%%/etc/nagios/nagios.cfg"
+
+load_rc_config "${name}"
+
+required_files="${nagios_configfile}"
+command_args="${command_args} ${nagios_configfile}"
+
+nagios_checkconfig() {
+ echo -n "Performing sanity check of nagios configuration: "
+ ${command} -v ${nagios_configfile} 2>&1 >/dev/null
+ if [ $? != 0 ]; then
+ echo "FAILED"
+ ${command} -v ${nagios_configfile}
+ return 1
+ else
+ echo "OK"
+ fi
+}
+
+start_precmd() {
+ if ! nagios_checkconfig; then
+ return 1
+ fi
+
+ su -m "${nagios_user}" -c "touch \"%%NAGIOSDIR%%/nagios.log\" \"%%NAGIOSDIR%%/status.sav\""
+ rm -f "%%NAGIOSDIR%%/rw/nagios.cmd"
+}
+
+stop_postcmd() {
+ rm -f "%%NAGIOSDIR%%/nagios.tmp" "%%NAGIOSDIR%%/rw/nagios.cmd"
+}
+
+run_rc_command "$1"
diff --git a/net-mgmt/nagios/files/nagios.sh.tmpl b/net-mgmt/nagios/files/nagios.sh.tmpl
deleted file mode 100644
index 137deebbe9a8..000000000000
--- a/net-mgmt/nagios/files/nagios.sh.tmpl
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-
-#
-# Add the following lines to /etc/rc.conf to enable nagios:
-#
-#nagios_enable="YES"
-#
-
-. %%RC_SUBR%%
-
-name=nagios
-rcvar=`set_rcvar`
-
-prefix=%%PREFIX%%
-
-required_files=${prefix}/etc/nagios/nagios.cfg
-
-NagiosBin=${prefix}/bin/nagios
-NagiosCfg=${prefix}/etc/nagios/nagios.cfg
-NagiosVar=%%NAGIOSDIR%%
-NagiosLog=${NagiosVar}/status.log
-NagiosTmp=${NagiosVar}/nagios.tmp
-NagiosSav=${NagiosVar}/status.sav
-NagiosCmd=${NagiosVar}/rw/nagios.cmd
-NagiosRun=${NagiosVar}/nagios.lock
-
-pidfile=${NagiosRun}
-command=${NagiosBin}
-command_args="-d $NagiosCfg"
-nagios_user=%%NAGIOSUSER%%
-
-start_precmd=start_precmd
-stop_postcmd=stop_postcmd
-restart_precmd=nagios_checkconfig
-
-# set defaults
-
-nagios_enable=${nagios_enable:-"NO"}
-nagios_flags=${nagios_flags:-""}
-
-nagios_checkconfig()
-{
- echo -n 'Performing sanity check on Nagios configuration: '
- $NagiosBin -v $NagiosCfg > /dev/null 2>&1
- if [ $? != 0 ]; then
- echo 'FAILED.'
- echo "Use '$NagiosBin -v $NagiosCfg' command for details."
- return 1
- else
- echo 'OK.'
- fi
-}
-
-start_precmd()
-{
- nagios_checkconfig; [ $? != 0 ] && return 1
-
- su -m ${nagios_user} -c "touch ${NagiosVar}/nagios.log ${NagiosSav}"
- rm -f ${NagiosCmd}
-}
-
-stop_postcmd()
-{
- rm -f $NagiosLog $NagiosTmp $NagiosRun $NagiosCmd
-}
-
-load_rc_config $name
-run_rc_command "$1"
diff --git a/net-mgmt/nagios/files/patch-Makefile.in b/net-mgmt/nagios/files/patch-Makefile.in
index 4d0a7a146117..b8b172b25938 100644
--- a/net-mgmt/nagios/files/patch-Makefile.in
+++ b/net-mgmt/nagios/files/patch-Makefile.in
@@ -1,5 +1,14 @@
---- Makefile.in.orig Thu Dec 16 02:15:24 2004
-+++ Makefile.in Sat Feb 12 13:52:19 2005
+--- Makefile.in.orig Sat Nov 26 17:35:35 2005
++++ Makefile.in Wed Dec 28 23:06:40 2005
+@@ -177,7 +177,7 @@
+ $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)
+ $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)/archives
+ if [ $(INSTALLPERLSTUFF) = yes ]; then \
+- $(INSTALL) -m 664 $(INSTALL_OPTS) p1.pl $(DESTDIR)$(BINDIR); \
++ $(INSTALL) -m 644 $(INSTALL_OPTS) p1.pl $(DESTDIR)$(BINDIR); \
+ fi;
+
+ @echo ""
@@ -204,14 +204,14 @@
diff --git a/net-mgmt/nagios/files/patch-base-utils.c b/net-mgmt/nagios/files/patch-base-utils.c
new file mode 100644
index 000000000000..22a17a7e9a2f
--- /dev/null
+++ b/net-mgmt/nagios/files/patch-base-utils.c
@@ -0,0 +1,11 @@
+--- base/utils.c.orig Sat Dec 24 06:01:36 2005
++++ base/utils.c Wed Dec 28 17:53:36 2005
+@@ -4546,7 +4546,7 @@
+
+ use_embedded_perl=TRUE;
+
+- PERL_SYS_INIT3(&argc,embedding,&env);
++ PERL_SYS_INIT3(&argc,&embedding,&env);
+
+ if((my_perl=perl_alloc())==NULL){
+ use_embedded_perl=FALSE;
diff --git a/net-mgmt/nagios/files/patch-contrib-Makefile.in b/net-mgmt/nagios/files/patch-contrib-Makefile.in
new file mode 100644
index 000000000000..dd80e3019859
--- /dev/null
+++ b/net-mgmt/nagios/files/patch-contrib-Makefile.in
@@ -0,0 +1,17 @@
+--- contrib/Makefile.in.orig Tue Nov 15 12:19:36 2005
++++ contrib/Makefile.in Wed Dec 28 17:49:25 2005
+@@ -46,10 +46,10 @@
+ devclean: distclean
+
+ install:
+- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CGIDIR)
+- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(BINDIR)
+- for f in $(CGIS); do $(INSTALL) -m 775 $(INSTALL_OPTS) $$f $(DESTDIR)$(CGIDIR); done
+- for f in $(UTILS); do $(INSTALL) -m 775 $(INSTALL_OPTS) $$f $(DESTDIR)$(BINDIR); done
++ $(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(CGIDIR)
++ $(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(BINDIR)
++ for f in $(CGIS); do $(INSTALL) -m 755 $(INSTALL_OPTS) $$f $(DESTDIR)$(CGIDIR); done
++ for f in $(UTILS); do $(INSTALL) -m 755 $(INSTALL_OPTS) $$f $(DESTDIR)$(BINDIR); done
+
+ ##############################################################################
+ # rules and dependencies for actual target programs
diff --git a/net-mgmt/nagios/files/pkg-deinstall.in b/net-mgmt/nagios/files/pkg-deinstall.in
new file mode 100644
index 000000000000..6b20aa9bc962
--- /dev/null
+++ b/net-mgmt/nagios/files/pkg-deinstall.in
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+NAGIOSDIR=%%NAGIOSDIR%%
+NAGIOSUSER=%%NAGIOSUSER%%
+NAGIOSGROUP=%%NAGIOSGROUP%%
+
+if [ "$2" = "POST-DEINSTALL" ]; then
+ if /usr/sbin/pw group show "${NAGIOSGROUP}" 2>&1 >/dev/null; then
+ echo "You should manually remove the \"${NAGIOSGROUP}\" group."
+ fi
+
+ 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 --git a/net-mgmt/nagios/files/pkg-install.in b/net-mgmt/nagios/files/pkg-install.in
new file mode 100644
index 000000000000..2575727530e0
--- /dev/null
+++ b/net-mgmt/nagios/files/pkg-install.in
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+NAGIOSDIR=%%NAGIOSDIR%%
+NAGIOSUSER=%%NAGIOSUSER%%
+NAGIOSGROUP=%%NAGIOSGROUP%%
+
+ask() {
+ local question default answer
+
+ question=$1
+ default=$2
+ if [ -z "${PACKAGE_BUILDING}" ]; then
+ read -p "${question} [${default}]? " answer
+ fi
+ if [ "x${answer}" = "x" ]; then
+ answer=${default}
+ fi
+ echo ${answer}
+}
+
+yesno() {
+ local default question answer
+
+ question=$1
+ default=$2
+ while :; do
+ answer=$(ask "${question}" "${default}")
+ case "${answer}" in
+ [Yy][Ee][Ss]|[Yy])
+ return 0
+ ;;
+ [Nn][Oo]|[Nn])
+ return 1
+ ;;
+ esac
+ echo "Please answer yes or no."
+ done
+}
+
+if [ "$2" = "PRE-INSTALL" ]; then
+ if /usr/sbin/pw group show "${NAGIOSGROUP}" 2>&1 >/dev/null; then
+ echo "You already have a \"${NAGIOSGROUP}\" group, so I will use it."
+ else
+ echo "You need a \"${NAGIOSGROUP}\" group."
+ if yesno "Would you like me to create it" "YES"; then
+ /usr/sbin/pw groupadd "${NAGIOSGROUP}" -h - || exit
+ echo "Done."
+ else
+ echo "Please create the \"${NAGIOSGROUP}\" group manually and try again."
+ exit 1
+ fi
+ fi
+
+ if /usr/sbin/pw user show "${NAGIOSUSER}" 2>&1 >/dev/null; then
+ echo "You already have a \"${NAGIOSUSER}\" user, so I will use it."
+ else
+ echo "You need a \"${NAGIOSUSER}\" user."
+ if yesno "Would you like me to create it" "YES"; then
+ /usr/sbin/pw useradd "${NAGIOSUSER}" -g "${NAGIOSGROUP}" -h - -d "${NAGIOSDIR}" \
+ -s /sbin/nologin -c "Nagios pseudo-user" || exit
+ else
+ echo "Please create the \"${NAGIOSUSER}\" user manually and try again."
+ exit 1
+ fi
+ fi
+fi
diff --git a/net-mgmt/nagios/files/pkg-message.in b/net-mgmt/nagios/files/pkg-message.in
new file mode 100644
index 000000000000..9d0c4ea7fbeb
--- /dev/null
+++ b/net-mgmt/nagios/files/pkg-message.in
@@ -0,0 +1,29 @@
+**********************************************************************
+
+ Enable nagios in /etc/rc.conf with the following line:
+
+ nagios_enable="YES"
+
+ Configuration templates are available in %%PREFIX%%/etc/nagios as
+ *.cfg-sample files. Copy then to *.cfg files where required and
+ edit to suit your needs. Documentation is available in HTML form
+ in %%PREFIX%%/%%NAGIOSWWWDIR%%/docs.
+
+ If you don't already have a web server running, you will need to
+ install and configure one to finish off your nagios installation.
+ When used with Apache, the following should be sufficient to publish
+ the web component of nagios (modification of allow list encouraged):
+
+ <Directory %%PREFIX%%/%%NAGIOSWWWDIR%%>
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+ <Directory %%PREFIX%%/%%NAGIOSWWWDIR%%/cgi-bin>
+ Options ExecCGI
+ </Directory>
+
+ ScriptAlias %%NAGIOSCGIURL%%/ %%PREFIX%%/%%NAGIOSWWWDIR%%/cgi-bin/
+ Alias %%NAGIOSHTMURL%%/ %%PREFIX%%/%%NAGIOSWWWDIR%%/
+
+**********************************************************************
diff --git a/net-mgmt/nagios/pkg-plist b/net-mgmt/nagios/pkg-plist
index ebf3d0a7244e..26ed14683652 100644
--- a/net-mgmt/nagios/pkg-plist
+++ b/net-mgmt/nagios/pkg-plist
@@ -6,6 +6,7 @@
@exec chown %%NAGIOSUSER%%:%%WWWGRP%% %%NAGIOSDIR%%/rw
bin/nagios
bin/nagiostats
+%%EMBEDDED_PERL%%bin/p1.pl
etc/nagios/bigger.cfg-sample
etc/nagios/cgi.cfg-sample
etc/nagios/checkcommands.cfg-sample
diff --git a/net-mgmt/nagios2/Makefile b/net-mgmt/nagios2/Makefile
index 995668484228..33f6e163cf8d 100644
--- a/net-mgmt/nagios2/Makefile
+++ b/net-mgmt/nagios2/Makefile
@@ -6,11 +6,11 @@
#
PORTNAME= nagios
-PORTVERSION= 2.0.b6
+PORTVERSION= 2.0.r1
+DISTVERSION= 2.0rc1
CATEGORIES= net-mgmt
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
-MASTER_SITE_SUBDIR=nagios
-DISTNAME= nagios-2.0b6
+MASTER_SITE_SUBDIR= nagios
MAINTAINER= jarrod@netleader.com.au
COMMENT= Extremely powerful network monitoring system
@@ -18,40 +18,39 @@ COMMENT= Extremely powerful network monitoring system
LIB_DEPENDS= gd.4:${PORTSDIR}/graphics/gd
RUN_DEPENDS= ${LOCALBASE}/libexec/nagios/check_nagios:${PORTSDIR}/net-mgmt/nagios-plugins
-USE_GETOPT_LONG=yes
-GNU_CONFIGURE= yes
+USE_GETOPT_LONG= yes
+USE_ICONV= yes
+USE_PERL5_BUILD= yes
USE_AUTOTOOLS= autoconf:259
-USE_RC_SUBR= yes
-USE_PERL5_BUILD=yes
+USE_RC_SUBR= nagios.sh
+USE_REINPLACE= yes
+
+OPTIONS= EMBEDDED_PERL "Enable embedded Perl [requires Perl 5.8+]" OFF \
+ NANOSLEEP "Use nanosleep in event timing" OFF
-PKGINSTALL= ${WRKDIR}/INSTALL
-PKGDEINSTALL= ${WRKDIR}/DEINSTALL
-PKGMESSAGE= ${WRKDIR}/MESSAGE
+GNU_CONFIGURE= yes
NAGIOSUSER?= nagios
NAGIOSGROUP?= nagios
NAGIOSDIR?= /var/spool/nagios
+NAGIOSWWWDIR?= www/nagios
NAGIOSHTMURL?= /nagios
NAGIOSCGIURL?= ${NAGIOSHTMURL}/cgi-bin
-.if defined(NAGIOSWWWDIR) || defined(WITH_NAGIOS_WWWDIR)
-NAGIOSWWWDIRSET=yes
-.endif
-
-.if defined(WITH_NAGIOS_WWWDIR) && !defined(NAGIOSWWWDIR)
-NAGIOSWWWDIR= www/nagios
-.else
-NAGIOSWWWDIR?= share/nagios
-.endif
+# Suggested NAGIOSHOMEURL values:
+# Home: main.html
+# Tactical Overview: ${NAGIOSCGIURL}/tac.cgi
+# Service Detail: ${NAGIOSCGIURL}/status.cgi?host=all
+# Host Detail: ${NAGIOSCGIURL}/status.cgi?hostgroup=all&style=hostdetail
+# Status Map: ${NAGIOSCGIURL}/statusmap.cgi?host=all
+NAGIOSHOMEURL?= main.html
.include <bsd.port.pre.mk>
CPPFLAGS= -I${LOCALBASE}/include -fPIC
-CONFIGURE_ENV= CPPFLAGS="${CPPFLAGS}" \
- LDFLAGS="${LDFLAGS}" \
- CFLAGS="${CPPFLAGS} ${CFLAGS}" \
- LIBS="-L${LOCALBASE}/lib -lgd"
+CFLAGS+= ${CPPFLAGS}
+
CONFIGURE_ARGS= --with-command-user=${NAGIOSUSER} \
--with-command-group=${WWWGRP} \
--with-nagios-user=${NAGIOSUSER} \
@@ -65,60 +64,53 @@ CONFIGURE_ARGS= --with-command-user=${NAGIOSUSER} \
--localstatedir=${NAGIOSDIR} \
--prefix=${PREFIX}
+CONFIGURE_ENV= CPPFLAGS="${CPPFLAGS}" \
+ CFLAGS="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ LIBS="-L${LOCALBASE}/lib" \
+ PERL=${PERL}
+
+INSTALL_TARGET= install install-commandmode install-config
+
PLIST_SUB= NAGIOSDIR=${NAGIOSDIR} \
NAGIOSWWWDIR=${NAGIOSWWWDIR} \
NAGIOSUSER=${NAGIOSUSER} \
NAGIOSGROUP=${NAGIOSGROUP} \
+ NAGIOSHTMURL=${NAGIOSHTMURL} \
+ NAGIOSCGIURL=${NAGIOSCGIURL} \
WWWGRP=${WWWGRP}
-SED_SCRIPT= -e 's,%%NAGIOSUSER%%,${NAGIOSUSER},g' \
- -e 's,%%NAGIOSGROUP%%,${NAGIOSGROUP},g' \
- -e 's,%%NAGIOSDIR%%,${NAGIOSDIR},g' \
- -e 's,%%NAGIOSWWWDIR%%,${NAGIOSWWWDIR},g' \
- -e 's,%%PREFIX%%,${PREFIX},g' \
- -e 's,%%RC_SUBR%%,${RC_SUBR},g'
-
-INSTALL_TARGET= all install config install-config install-commandmode
-
-pre-everything::
-.if !defined(NAGIOSWWWDIRSET)
- @${ECHO_CMD} "**********************************************************************"
- @${ECHO_CMD} ""
- @${ECHO_CMD} " The web component of this port is currently being installed under"
- @${ECHO_CMD} " ${PREFIX}/${NAGIOSWWWDIR}, the default for which is being changed"
- @${ECHO_CMD} " when Nagios 2.0 is released. If this is a new installation, please"
- @${ECHO_CMD} " consider adding the following option to /etc/make.conf to install the"
- @${ECHO_CMD} " component under the correct home of ${PREFIX}/www/nagios:"
- @${ECHO_CMD} ""
- @${ECHO_CMD} " # net-mgmt/nagios"
- @${ECHO_CMD} " WITH_NAGIOS_WWWDIR=YES"
- @${ECHO_CMD} ""
- @${ECHO_CMD} " Existing installations can be upgraded with this option with only"
- @${ECHO_CMD} " minor changes being required to etc/apache[2]/httpd.conf to change"
- @${ECHO_CMD} " references of ${PREFIX}/${NAGIOSWWWDIR} to ${PREFIX}/www/nagios."
- @${ECHO_CMD} ""
- @${ECHO_CMD} " Should you wish to continue using ${PREFIX}/${NAGIOSWWWDIR}, define"
- @${ECHO_CMD} " the NAGIOSWWWDIR variable without the ${PREFIX}/ prefix:"
- @${ECHO_CMD} ""
- @${ECHO_CMD} " # net-mgmt/nagios"
- @${ECHO_CMD} " NAGIOSWWWDIR=${NAGIOSWWWDIR}"
- @${ECHO_CMD} ""
- @${ECHO_CMD} " The WITH_NAGIOS_WWWDIR knob will vanish once the default has been"
- @${ECHO_CMD} " changed and the NAGIOSWWWDIR tunable option will remain permanently."
- @${ECHO_CMD} ""
- @${ECHO_CMD} "**********************************************************************"
+SUB_FILES= pkg-install \
+ pkg-deinstall \
+ pkg-message
+
+SUB_LIST= PREFIX=${PREFIX} \
+ ${PLIST_SUB}
+
+.if defined(WITH_EMBEDDED_PERL)
+.if ${PERL_LEVEL} >= 500800
+USE_PERL5= yes
+CONFIGURE_ARGS+= --enable-embedded-perl \
+ --with-perlcache
+.else
+IGNORE= "Embedded Perl requires Perl 5.8 or higher (see lang/perl5.8)"
+.endif
+PLIST_SUB+= EMBEDDED_PERL=""
+.else
+PLIST_SUB+= EMBEDDED_PERL="@comment "
+.endif
+
+.if defined(WITH_NANOSLEEP)
+CONFIGURE_ARGS+= --enable-nanosleep
.endif
-pre-build:
- for myfile in nagios.sh INSTALL DEINSTALL MESSAGE; do \
- ${SED} ${SED_SCRIPT} < ${FILESDIR}/$${myfile}.tmpl >${WRKDIR}/$${myfile}; \
- done
+post-patch:
+ ${REINPLACE_CMD} -e 's#"main.html"#"${NAGIOSHOMEURL:S/\//\\\//g:S/&/\\&/g}"#' ${WRKSRC}/html/index.html.in
pre-install:
@${SH} ${PKGINSTALL} ${DISTNAME} PRE-INSTALL
post-install:
- @${INSTALL_SCRIPT} ${WRKDIR}/nagios.sh ${PREFIX}/etc/rc.d/
@${CHMOD} 775 ${NAGIOSDIR} ${NAGIOSDIR}/archives ${NAGIOSDIR}/rw
@${CHOWN} ${NAGIOSUSER}:${NAGIOSGROUP} ${NAGIOSDIR} ${NAGIOSDIR}/archives
@${CHOWN} ${NAGIOSUSER}:${WWWGRP} ${NAGIOSDIR}/rw
diff --git a/net-mgmt/nagios2/distinfo b/net-mgmt/nagios2/distinfo
index 0e83ee5c1b5e..11d38ba18279 100644
--- a/net-mgmt/nagios2/distinfo
+++ b/net-mgmt/nagios2/distinfo
@@ -1,2 +1,2 @@
-MD5 (nagios-2.0b6.tar.gz) = c4a08697f852b0d535bf34fff0bf8b1f
-SIZE (nagios-2.0b6.tar.gz) = 1728173
+MD5 (nagios-2.0rc1.tar.gz) = 5807fc2f1cf5355a2eadc6f4d51f6711
+SIZE (nagios-2.0rc1.tar.gz) = 1731687
diff --git a/net-mgmt/nagios2/files/DEINSTALL.tmpl b/net-mgmt/nagios2/files/DEINSTALL.tmpl
deleted file mode 100644
index 93ed52b4d017..000000000000
--- a/net-mgmt/nagios2/files/DEINSTALL.tmpl
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-
-USER=%%NAGIOSUSER%%
-GROUP=%%NAGIOSGROUP%%
-DIR=%%NAGIOSDIR%%
-
-if [ "$2" = "POST-DEINSTALL" ]; then
-
- if /usr/sbin/pw group show "${GROUP}" 2>&1 >/dev/null; then
- echo "You should manually remove the \"${GROUP}\" group."
- fi
-
- if /usr/sbin/pw user show "${USER}" 2>&1 >/dev/null; then
- echo "You should manually remove the \"${USER}\" user."
- fi
-
- if [ -e ${DIR} ]; then
- echo "You should manually remove the \"${DIR}\" directory."
- fi
-fi
diff --git a/net-mgmt/nagios2/files/INSTALL.tmpl b/net-mgmt/nagios2/files/INSTALL.tmpl
deleted file mode 100644
index 7ef71df5d57f..000000000000
--- a/net-mgmt/nagios2/files/INSTALL.tmpl
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: /tmp/pcvs/ports/net-mgmt/nagios2/files/Attic/INSTALL.tmpl,v 1.1 2004-02-11 04:56:00 linimon Exp $
-#
-
-USER=%%NAGIOSUSER%%
-GROUP=%%NAGIOSGROUP%%
-DIR=%%NAGIOSDIR%%
-
-ask() {
- local question default answer
-
- question=$1
- default=$2
- if [ -z "${PACKAGE_BUILDING}" ]; then
- read -p "${question} [${default}]? " answer
- fi
- if [ x${answer} = x ]; then
- answer=${default}
- fi
- echo ${answer}
-}
-
-yesno() {
- local dflt question answer
-
- question=$1
- dflt=$2
- while :; do
- answer=$(ask "${question}" "${dflt}")
- case "${answer}" in
- [Yy]*) return 0;;
- [Nn]*) return 1;;
- esac
- echo "Please answer yes or no."
- done
-}
-
-if [ x"$2" = xPRE-INSTALL ]; then
- if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then
- echo "You already have a group \"${GROUP}\", so I will use it."
- else
- echo "You need a group \"${GROUP}\"."
- if yesno "Would you like me to create it" y; then
- /usr/sbin/pw groupadd ${GROUP} -h - || exit
- echo "Done."
- else
- echo "Please create it, and try again."
- exit 1
- fi
- fi
-
- if /usr/sbin/pw user show "${USER}" 2>/dev/null; then
- echo "You already have a user \"${USER}\", so I will use it."
- else
- echo "You need a user \"${USER}\"."
- if yesno "Would you like me to create it" y; then
- /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - -d ${DIR} \
- -s /nonexistent -c "Nagios pseudo-user" || exit
- echo "Done."
- else
- echo "Please create it, and try again."
- exit 1
- fi
- fi
-
-fi
diff --git a/net-mgmt/nagios2/files/MESSAGE.tmpl b/net-mgmt/nagios2/files/MESSAGE.tmpl
deleted file mode 100644
index 234bb9c24189..000000000000
--- a/net-mgmt/nagios2/files/MESSAGE.tmpl
+++ /dev/null
@@ -1,15 +0,0 @@
-
-*******************************************************************
- Enable nagios in /etc/rc.conf with the following line:
-
- nagios_enable="YES"
-
- Configuration templates are available in %%PREFIX%%/etc/nagios
- as *.cfg-sample files. Copy them to *.cfg and edit them to suit
- your needs. Documentation is available in HTML form in
- %%PREFIX%%/%%NAGIOSWWWDIR%%/docs.
-
- If you don't already have a web server running, you need to install
- and configure it to finish your nagios installation.
-*******************************************************************
-
diff --git a/net-mgmt/nagios2/files/nagios.sh.in b/net-mgmt/nagios2/files/nagios.sh.in
new file mode 100644
index 000000000000..03207c926b44
--- /dev/null
+++ b/net-mgmt/nagios2/files/nagios.sh.in
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+#
+# Add the following lines to /etc/rc.conf to enable nagios:
+# nagios_enable (bool): Set to "NO" by default.
+# Set it to "YES" to enable nagios.
+# nagios_flags (str): Set to "" by default.
+# nagios_configfile (str): Set to "%%PREFIX%%/etc/nagios/nagios.cfg" by default.
+#
+
+. %%RC_SUBR%%
+
+name="nagios"
+rcvar=`set_rcvar`
+
+command="%%PREFIX%%/bin/nagios"
+command_args="-d"
+pidfile="%%NAGIOSDIR%%/nagios.lock"
+nagios_user="%%NAGIOSUSER%%"
+
+start_precmd="start_precmd"
+stop_postcmd="stop_postcmd"
+restart_precmd="nagios_checkconfig"
+
+[ -z "${nagios_enable}" ] && nagios_enable="NO"
+[ -z "${nagios_flags}" ] && nagios_flags=""
+[ -z "${nagios_configfile}" ] && nagios_configfile="%%PREFIX%%/etc/nagios/nagios.cfg"
+
+load_rc_config "${name}"
+
+required_files="${nagios_configfile}"
+command_args="${command_args} ${nagios_configfile}"
+
+nagios_checkconfig() {
+ echo -n "Performing sanity check of nagios configuration: "
+ ${command} -v ${nagios_configfile} 2>&1 >/dev/null
+ if [ $? != 0 ]; then
+ echo "FAILED"
+ ${command} -v ${nagios_configfile}
+ return 1
+ else
+ echo "OK"
+ fi
+}
+
+start_precmd() {
+ if ! nagios_checkconfig; then
+ return 1
+ fi
+
+ su -m "${nagios_user}" -c "touch \"%%NAGIOSDIR%%/nagios.log\" \"%%NAGIOSDIR%%/status.sav\""
+ rm -f "%%NAGIOSDIR%%/rw/nagios.cmd"
+}
+
+stop_postcmd() {
+ rm -f "%%NAGIOSDIR%%/nagios.tmp" "%%NAGIOSDIR%%/rw/nagios.cmd"
+}
+
+run_rc_command "$1"
diff --git a/net-mgmt/nagios2/files/nagios.sh.tmpl b/net-mgmt/nagios2/files/nagios.sh.tmpl
deleted file mode 100644
index 137deebbe9a8..000000000000
--- a/net-mgmt/nagios2/files/nagios.sh.tmpl
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-
-#
-# Add the following lines to /etc/rc.conf to enable nagios:
-#
-#nagios_enable="YES"
-#
-
-. %%RC_SUBR%%
-
-name=nagios
-rcvar=`set_rcvar`
-
-prefix=%%PREFIX%%
-
-required_files=${prefix}/etc/nagios/nagios.cfg
-
-NagiosBin=${prefix}/bin/nagios
-NagiosCfg=${prefix}/etc/nagios/nagios.cfg
-NagiosVar=%%NAGIOSDIR%%
-NagiosLog=${NagiosVar}/status.log
-NagiosTmp=${NagiosVar}/nagios.tmp
-NagiosSav=${NagiosVar}/status.sav
-NagiosCmd=${NagiosVar}/rw/nagios.cmd
-NagiosRun=${NagiosVar}/nagios.lock
-
-pidfile=${NagiosRun}
-command=${NagiosBin}
-command_args="-d $NagiosCfg"
-nagios_user=%%NAGIOSUSER%%
-
-start_precmd=start_precmd
-stop_postcmd=stop_postcmd
-restart_precmd=nagios_checkconfig
-
-# set defaults
-
-nagios_enable=${nagios_enable:-"NO"}
-nagios_flags=${nagios_flags:-""}
-
-nagios_checkconfig()
-{
- echo -n 'Performing sanity check on Nagios configuration: '
- $NagiosBin -v $NagiosCfg > /dev/null 2>&1
- if [ $? != 0 ]; then
- echo 'FAILED.'
- echo "Use '$NagiosBin -v $NagiosCfg' command for details."
- return 1
- else
- echo 'OK.'
- fi
-}
-
-start_precmd()
-{
- nagios_checkconfig; [ $? != 0 ] && return 1
-
- su -m ${nagios_user} -c "touch ${NagiosVar}/nagios.log ${NagiosSav}"
- rm -f ${NagiosCmd}
-}
-
-stop_postcmd()
-{
- rm -f $NagiosLog $NagiosTmp $NagiosRun $NagiosCmd
-}
-
-load_rc_config $name
-run_rc_command "$1"
diff --git a/net-mgmt/nagios2/files/patch-Makefile.in b/net-mgmt/nagios2/files/patch-Makefile.in
index 4d0a7a146117..b8b172b25938 100644
--- a/net-mgmt/nagios2/files/patch-Makefile.in
+++ b/net-mgmt/nagios2/files/patch-Makefile.in
@@ -1,5 +1,14 @@
---- Makefile.in.orig Thu Dec 16 02:15:24 2004
-+++ Makefile.in Sat Feb 12 13:52:19 2005
+--- Makefile.in.orig Sat Nov 26 17:35:35 2005
++++ Makefile.in Wed Dec 28 23:06:40 2005
+@@ -177,7 +177,7 @@
+ $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)
+ $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)/archives
+ if [ $(INSTALLPERLSTUFF) = yes ]; then \
+- $(INSTALL) -m 664 $(INSTALL_OPTS) p1.pl $(DESTDIR)$(BINDIR); \
++ $(INSTALL) -m 644 $(INSTALL_OPTS) p1.pl $(DESTDIR)$(BINDIR); \
+ fi;
+
+ @echo ""
@@ -204,14 +204,14 @@
diff --git a/net-mgmt/nagios2/files/patch-base-utils.c b/net-mgmt/nagios2/files/patch-base-utils.c
new file mode 100644
index 000000000000..22a17a7e9a2f
--- /dev/null
+++ b/net-mgmt/nagios2/files/patch-base-utils.c
@@ -0,0 +1,11 @@
+--- base/utils.c.orig Sat Dec 24 06:01:36 2005
++++ base/utils.c Wed Dec 28 17:53:36 2005
+@@ -4546,7 +4546,7 @@
+
+ use_embedded_perl=TRUE;
+
+- PERL_SYS_INIT3(&argc,embedding,&env);
++ PERL_SYS_INIT3(&argc,&embedding,&env);
+
+ if((my_perl=perl_alloc())==NULL){
+ use_embedded_perl=FALSE;
diff --git a/net-mgmt/nagios2/files/patch-contrib-Makefile.in b/net-mgmt/nagios2/files/patch-contrib-Makefile.in
new file mode 100644
index 000000000000..dd80e3019859
--- /dev/null
+++ b/net-mgmt/nagios2/files/patch-contrib-Makefile.in
@@ -0,0 +1,17 @@
+--- contrib/Makefile.in.orig Tue Nov 15 12:19:36 2005
++++ contrib/Makefile.in Wed Dec 28 17:49:25 2005
+@@ -46,10 +46,10 @@
+ devclean: distclean
+
+ install:
+- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CGIDIR)
+- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(BINDIR)
+- for f in $(CGIS); do $(INSTALL) -m 775 $(INSTALL_OPTS) $$f $(DESTDIR)$(CGIDIR); done
+- for f in $(UTILS); do $(INSTALL) -m 775 $(INSTALL_OPTS) $$f $(DESTDIR)$(BINDIR); done
++ $(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(CGIDIR)
++ $(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(BINDIR)
++ for f in $(CGIS); do $(INSTALL) -m 755 $(INSTALL_OPTS) $$f $(DESTDIR)$(CGIDIR); done
++ for f in $(UTILS); do $(INSTALL) -m 755 $(INSTALL_OPTS) $$f $(DESTDIR)$(BINDIR); done
+
+ ##############################################################################
+ # rules and dependencies for actual target programs
diff --git a/net-mgmt/nagios2/files/pkg-deinstall.in b/net-mgmt/nagios2/files/pkg-deinstall.in
new file mode 100644
index 000000000000..6b20aa9bc962
--- /dev/null
+++ b/net-mgmt/nagios2/files/pkg-deinstall.in
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+NAGIOSDIR=%%NAGIOSDIR%%
+NAGIOSUSER=%%NAGIOSUSER%%
+NAGIOSGROUP=%%NAGIOSGROUP%%
+
+if [ "$2" = "POST-DEINSTALL" ]; then
+ if /usr/sbin/pw group show "${NAGIOSGROUP}" 2>&1 >/dev/null; then
+ echo "You should manually remove the \"${NAGIOSGROUP}\" group."
+ fi
+
+ 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 --git a/net-mgmt/nagios2/files/pkg-install.in b/net-mgmt/nagios2/files/pkg-install.in
new file mode 100644
index 000000000000..2575727530e0
--- /dev/null
+++ b/net-mgmt/nagios2/files/pkg-install.in
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+NAGIOSDIR=%%NAGIOSDIR%%
+NAGIOSUSER=%%NAGIOSUSER%%
+NAGIOSGROUP=%%NAGIOSGROUP%%
+
+ask() {
+ local question default answer
+
+ question=$1
+ default=$2
+ if [ -z "${PACKAGE_BUILDING}" ]; then
+ read -p "${question} [${default}]? " answer
+ fi
+ if [ "x${answer}" = "x" ]; then
+ answer=${default}
+ fi
+ echo ${answer}
+}
+
+yesno() {
+ local default question answer
+
+ question=$1
+ default=$2
+ while :; do
+ answer=$(ask "${question}" "${default}")
+ case "${answer}" in
+ [Yy][Ee][Ss]|[Yy])
+ return 0
+ ;;
+ [Nn][Oo]|[Nn])
+ return 1
+ ;;
+ esac
+ echo "Please answer yes or no."
+ done
+}
+
+if [ "$2" = "PRE-INSTALL" ]; then
+ if /usr/sbin/pw group show "${NAGIOSGROUP}" 2>&1 >/dev/null; then
+ echo "You already have a \"${NAGIOSGROUP}\" group, so I will use it."
+ else
+ echo "You need a \"${NAGIOSGROUP}\" group."
+ if yesno "Would you like me to create it" "YES"; then
+ /usr/sbin/pw groupadd "${NAGIOSGROUP}" -h - || exit
+ echo "Done."
+ else
+ echo "Please create the \"${NAGIOSGROUP}\" group manually and try again."
+ exit 1
+ fi
+ fi
+
+ if /usr/sbin/pw user show "${NAGIOSUSER}" 2>&1 >/dev/null; then
+ echo "You already have a \"${NAGIOSUSER}\" user, so I will use it."
+ else
+ echo "You need a \"${NAGIOSUSER}\" user."
+ if yesno "Would you like me to create it" "YES"; then
+ /usr/sbin/pw useradd "${NAGIOSUSER}" -g "${NAGIOSGROUP}" -h - -d "${NAGIOSDIR}" \
+ -s /sbin/nologin -c "Nagios pseudo-user" || exit
+ else
+ echo "Please create the \"${NAGIOSUSER}\" user manually and try again."
+ exit 1
+ fi
+ fi
+fi
diff --git a/net-mgmt/nagios2/files/pkg-message.in b/net-mgmt/nagios2/files/pkg-message.in
new file mode 100644
index 000000000000..9d0c4ea7fbeb
--- /dev/null
+++ b/net-mgmt/nagios2/files/pkg-message.in
@@ -0,0 +1,29 @@
+**********************************************************************
+
+ Enable nagios in /etc/rc.conf with the following line:
+
+ nagios_enable="YES"
+
+ Configuration templates are available in %%PREFIX%%/etc/nagios as
+ *.cfg-sample files. Copy then to *.cfg files where required and
+ edit to suit your needs. Documentation is available in HTML form
+ in %%PREFIX%%/%%NAGIOSWWWDIR%%/docs.
+
+ If you don't already have a web server running, you will need to
+ install and configure one to finish off your nagios installation.
+ When used with Apache, the following should be sufficient to publish
+ the web component of nagios (modification of allow list encouraged):
+
+ <Directory %%PREFIX%%/%%NAGIOSWWWDIR%%>
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+ <Directory %%PREFIX%%/%%NAGIOSWWWDIR%%/cgi-bin>
+ Options ExecCGI
+ </Directory>
+
+ ScriptAlias %%NAGIOSCGIURL%%/ %%PREFIX%%/%%NAGIOSWWWDIR%%/cgi-bin/
+ Alias %%NAGIOSHTMURL%%/ %%PREFIX%%/%%NAGIOSWWWDIR%%/
+
+**********************************************************************
diff --git a/net-mgmt/nagios2/pkg-plist b/net-mgmt/nagios2/pkg-plist
index ebf3d0a7244e..26ed14683652 100644
--- a/net-mgmt/nagios2/pkg-plist
+++ b/net-mgmt/nagios2/pkg-plist
@@ -6,6 +6,7 @@
@exec chown %%NAGIOSUSER%%:%%WWWGRP%% %%NAGIOSDIR%%/rw
bin/nagios
bin/nagiostats
+%%EMBEDDED_PERL%%bin/p1.pl
etc/nagios/bigger.cfg-sample
etc/nagios/cgi.cfg-sample
etc/nagios/checkcommands.cfg-sample