ports/62537: MAINTAINER UPDATE: net/nagios update to 1.2
Blaz Zupan
blaz at si.FreeBSD.org
Sun Feb 8 14:20:16 UTC 2004
>Number: 62537
>Category: ports
>Synopsis: MAINTAINER UPDATE: net/nagios update to 1.2
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: maintainer-update
>Submitter-Id: current-users
>Arrival-Date: Sun Feb 08 06:20:15 PST 2004
>Closed-Date:
>Last-Modified:
>Originator: Blaz Zupan
>Release: FreeBSD 4.9-RELEASE-p1 i386
>Organization:
>Environment:
System: FreeBSD titanic.medinet.si 4.9-RELEASE-p1 FreeBSD 4.9-RELEASE-p1 #3: Sat Dec 20 15:57:16 CET 2003 root at bigbrother.amis.net:/db/obj/usr/src/sys/TITANIC i386
>Description:
For commiter:
- remove files/patch-aj, no longer needed with 1.2
- repocopy pkg-install to files/INSTALL.tmpl
(not really needed as there is no significant history)
- remove pkg-install
- update files/INSTALL.tmpl
- add files/DEINSTALL.tmpl
- add files/MESSAGES.tmpl
Commit log:
- update to nagios 1.2
- we depend on perl5 on build
- remove nagmin support as the nagmin port was never commited
- add rc.subr support
- document supported tunables
- add post-install documentation that documents the remaining
steps the user needs to take to finish the installation
- add deinstallation script the reminds the user to remove
the username, group and directory
>How-To-Repeat:
>Fix:
diff -urN nagios.old/Makefile nagios/Makefile
--- nagios.old/Makefile Thu Dec 4 14:53:29 2003
+++ nagios/Makefile Sun Feb 8 14:50:50 2004
@@ -6,8 +6,7 @@
#
PORTNAME= nagios
-PORTVERSION= 1.1
-PORTREVISION= 4
+PORTVERSION= 1.2
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR=nagios
@@ -24,24 +23,33 @@
USE_GETOPT_LONG=yes
GNU_CONFIGURE= yes
+USE_RC_SUBR= yes
+USE_PERL5_BUILD=yes
+
+PKGINSTALL= ${WRKDIR}/INSTALL
+PKGDEINSTALL= ${WRKDIR}/DEINSTALL
+PKGMESSAGE= ${WRKDIR}/MESSAGE
+
+NAGIOSUSER?= nagios
+NAGIOSGROUP?= nagios
+NAGIOSDIR?= /var/spool/nagios
CPPFLAGS= ${INCGD} -I${LOCALBASE}/include
CONFIGURE_ENV= CPPFLAGS="${CPPFLAGS}" \
LDFLAGS="${LDFLAGS}" \
CFLAGS="${CPPFLAGS} ${CFLAGS} ${INCGD}" \
LIBS="-L${LOCALBASE}/lib ${LIBGD}"
-CONFIGURE_ARGS= --with-command-user=nagios \
+CONFIGURE_ARGS= --with-command-user=${NAGIOSUSER} \
--with-command-grp=www \
- --with-nagios-user=nagios \
- --with-nagios-grp=nagios \
+ --with-nagios-user=${NAGIOSUSER} \
+ --with-nagios-grp=${NAGIOSGROUP} \
--with-template-objects \
--with-template-extinfo \
- --with-init-dir=${PREFIX}/etc/rc.d \
--sbindir=${PREFIX}/share/nagios/cgi-bin \
--libexecdir=${PREFIX}/libexec/nagios \
--datadir=${PREFIX}/share/nagios \
--sysconfdir=${PREFIX}/etc/nagios \
- --localstatedir=/var/spool/nagios \
+ --localstatedir=${NAGIOSDIR} \
--prefix=${PREFIX}
.if defined(WITH_GD1)
@@ -52,21 +60,13 @@
LIBGD= -lgd
.endif
-.if defined(WITH_MYSQL)||defined(WITH_NAGMIN)
+.if defined(WITH_MYSQL)
USE_MYSQL= yes
CONFIGURE_ARGS+= --with-mysql-lib=${LOCALBASE}/lib/mysql \
--with-mysql-inc=${LOCALBASE}/include/mysql \
--with-mysql-xdata
.endif
-.if defined(WITH_NAGMIN)
-RUN_DEPENDS+= nagmin:${PORTSDIR}/sysutils/nagmin
-CONFIGURE_ARGS+= --with-myqsl-comments \
- --with-mysql-downtime \
- --with-mysql-retention \
- --with-mysql-status
-.endif
-
.if defined(NAGIOS_FILE_PERFDATA)
CONFIGURE_ARGS+=--with-file-perfdata
.endif
@@ -78,9 +78,34 @@
--with-pgsql-xdata
.endif
-INSTALL_TARGET= all install config install-config install-daemoninit install-commandmode
+SED_SCRIPT= -e 's,%%NAGIOSUSER%%,${NAGIOSUSER},g' \
+ -e 's,%%NAGIOSGROUP%%,${NAGIOSGROUP},g' \
+ -e 's,%%NAGIOSDIR%%,${NAGIOSDIR},g' \
+ -e 's,%%PREFIX%%,${PREFIX},g' \
+ -e 's,%%RC_SUBR%%,${RC_SUBR},g'
+
+INSTALL_TARGET= all install config install-config install-commandmode
+
+pre-everything::
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "nagios has the following tunables:"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} " WITH_MYSQL=yes Compile with MySQL suport"
+ @${ECHO_MSG} " WITH_POSTGRES=yes Compile with PostgreSQL suport"
+ @${ECHO_MSG} " WITH_GD1=yes Compile with GD1 instead of GD2"
+ @${ECHO_MSG} " NAGIOS_FILE_PERFDATA=yes Save performance data to files"
+ @${ECHO_MSG} ""
+
+pre-build:
+ for file in nagios.sh INSTALL DEINSTALL MESSAGE; do \
+ ${SED} ${SED_SCRIPT} < ${FILESDIR}/$${file}.tmpl >${WRKDIR}/$${file}; \
+ done
pre-install:
- @PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
+ @${SH} ${PKGINSTALL} ${DISTNAME} PRE-INSTALL
+
+post-install:
+ @${INSTALL_SCRIPT} ${WRKDIR}/nagios.sh ${PREFIX}/etc/rc.d/
+ @${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>
diff -urN nagios.old/distinfo nagios/distinfo
--- nagios.old/distinfo Sun Jun 8 14:55:22 2003
+++ nagios/distinfo Wed Feb 4 21:23:43 2004
@@ -1 +1 @@
-MD5 (nagios-1.1.tar.gz) = 5f48ecd9bad2c4d7c9d88d0b6f347ecf
+MD5 (nagios-1.2.tar.gz) = 414d70e5269d5b8d7c21bf3ee129309f
diff -urN nagios.old/files/DEINSTALL.tmpl nagios/files/DEINSTALL.tmpl
--- nagios.old/files/DEINSTALL.tmpl Thu Jan 1 01:00:00 1970
+++ nagios/files/DEINSTALL.tmpl Sun Feb 8 13:59:21 2004
@@ -0,0 +1,23 @@
+#!/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 -urN nagios.old/files/INSTALL.tmpl nagios/files/INSTALL.tmpl
--- nagios.old/files/INSTALL.tmpl Thu Jan 1 01:00:00 1970
+++ nagios/files/INSTALL.tmpl Sun Feb 8 14:10:14 2004
@@ -0,0 +1,67 @@
+#!/bin/sh
+#
+# $FreeBSD: ports/net/nagios/pkg-install,v 1.2 2002/05/29 06:35:16 kuriyama 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 -urN nagios.old/files/MESSAGE.tmpl nagios/files/MESSAGE.tmpl
--- nagios.old/files/MESSAGE.tmpl Thu Jan 1 01:00:00 1970
+++ nagios/files/MESSAGE.tmpl Sun Feb 8 13:47:38 2004
@@ -0,0 +1,15 @@
+
+*******************************************************************
+ 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%%/share/nagios/docs.
+
+ If you don't already have a web server running, you need to install
+ and configure it to finish your nagios installation.
+*******************************************************************
+
diff -urN nagios.old/files/nagios.sh.tmpl nagios/files/nagios.sh.tmpl
--- nagios.old/files/nagios.sh.tmpl Thu Jan 1 01:00:00 1970
+++ nagios/files/nagios.sh.tmpl Thu Feb 5 19:56:59 2004
@@ -0,0 +1,55 @@
+#!/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=/var/spool/nagios
+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=nagios
+
+start_precmd=start_precmd
+stop_postcmd=stop_postcmd
+
+# set defaults
+
+nagios_enable=${nagios_enable:-"NO"}
+nagios_flags=${nagios_flags:-""}
+
+start_precmd()
+{
+ 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 -urN nagios.old/files/patch-ad nagios/files/patch-ad
--- nagios.old/files/patch-ad Sat Aug 2 17:02:05 2003
+++ nagios/files/patch-ad Wed Feb 4 21:26:55 2004
@@ -1,5 +1,5 @@
---- configure.orig Tue Jun 3 12:47:57 2003
-+++ configure Thu Jul 31 16:35:45 2003
+--- configure.orig Tue Feb 3 05:45:08 2004
++++ configure Wed Feb 4 21:26:46 2004
@@ -11,7 +11,7 @@
ac_help=
ac_default_prefix=/usr/local
@@ -40,30 +40,30 @@
fi
-@@ -2748,14 +2753,14 @@
- fi
+@@ -2692,14 +2697,14 @@
- if test x$GDLIBFOUND = x; then
-- echo $ac_n "checking for gdImagePng in -lgd (order 3)""... $ac_c" 1>&6
--echo "configure:2753: checking for gdImagePng in -lgd (order 3)" >&5
-+ echo $ac_n "checking for gdImagePng in -lgd1 (order 3)""... $ac_c" 1>&6
-+echo "configure:2753: checking for gdImagePng in -lgd1 (order 3)" >&5
- ac_lib_var=`echo gd'_'gdImagePng'_'3 | sed 'y%./+-%__p_%'`
+
+
+- echo $ac_n "checking for gdImagePng in -lgd (order 1)""... $ac_c" 1>&6
+-echo "configure:2697: checking for gdImagePng in -lgd (order 1)" >&5
++ echo $ac_n "checking for gdImagePng in -lgd1 (order 1)""... $ac_c" 1>&6
++echo "configure:2697: checking for gdImagePng in -lgd1 (order 1)" >&5
+ ac_lib_var=`echo gd'_'gdImagePng'_'1 | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
-- LIBS="-lgd -lpng -lz -lm $LIBS"
-+ LIBS="-lgd1 -lz -lm -lpng -ljpeg $LIBS"
+- LIBS="-lgd $ICONV -lz -lm -lpng -ljpeg $LIBS"
++ LIBS="-lgd1 $ICONV -lz -lm -lpng -ljpeg $LIBS"
cat > conftest.$ac_ext <<EOF
- #line 2761 "configure"
+ #line 2705 "configure"
#include "confdefs.h"
-@@ -2785,7 +2790,7 @@
+@@ -2729,7 +2734,7 @@
echo "$ac_t""yes" 1>&6
GDLIBFOUND=yep
-- GDLIBS="-lgd -lpng -lz -lm"
-+ GDLIBS="-lgd1 -lz -lm -lpng"
+- GDLIBS="-lgd $ICONV -lz -lm -lpng -ljpeg"
++ GDLIBS="-lgd1 $ICONV -lz -lm -lpng -ljpeg"
else
echo "$ac_t""no" 1>&6
diff -urN nagios.old/files/patch-aj nagios/files/patch-aj
--- nagios.old/files/patch-aj Mon Aug 4 12:00:31 2003
+++ nagios/files/patch-aj Thu Jan 1 01:00:00 1970
@@ -1,13 +0,0 @@
---- cgi/tac.c.orig Mon May 12 06:18:56 2003
-+++ cgi/tac.c Sat Aug 2 16:24:23 2003
-@@ -1220,10 +1220,8 @@
- printf("</table>\n");
- printf("</td>\n");
-
-- /*
- printf("</tr>\n");
- printf("</table>\n");
-- */
-
- printf("</td>\n");
-
diff -urN nagios.old/pkg-install nagios/pkg-install
--- nagios.old/pkg-install Wed May 29 08:35:16 2002
+++ nagios/pkg-install Thu Jan 1 01:00:00 1970
@@ -1,68 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: ports/net/nagios/pkg-install,v 1.2 2002/05/29 06:35:16 kuriyama Exp $
-#
-
-PKG_PREFIX=${PKG_PREFIX:=/usr/local}
-
-user=nagios
-group=nagios
-
-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 ${PKG_PREFIX}/var/nagios \
- -s /nonexistent -c "Nagios pseudo-user" || exit
- echo "Done."
- else
- echo "Please create it, and try again."
- exit 1
- fi
- fi
-
-fi
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list