From 294bf5a13f2dbf7b1a440170ba6841d8bcd7a758 Mon Sep 17 00:00:00 2001 From: Mark Linimon Date: Wed, 11 Feb 2004 04:56:00 +0000 Subject: Update to 1.2: mostly bugfixes, but also configuration for other OSes. See Changelog for details. Details about the changes to the port (as differntiated from the source): - 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 PR: ports/62537 Submitted by: Blaz Zupan (maintainer) --- net-mgmt/nagios/Makefile | 61 ++++++++++++++++++++++---------- net-mgmt/nagios/distinfo | 2 +- net-mgmt/nagios/files/DEINSTALL.tmpl | 23 ++++++++++++ net-mgmt/nagios/files/INSTALL.tmpl | 67 +++++++++++++++++++++++++++++++++++ net-mgmt/nagios/files/MESSAGE.tmpl | 15 ++++++++ net-mgmt/nagios/files/nagios.sh.tmpl | 55 +++++++++++++++++++++++++++++ net-mgmt/nagios/files/patch-ad | 32 ++++++++--------- net-mgmt/nagios/files/patch-aj | 13 ------- net-mgmt/nagios/pkg-install | 68 ------------------------------------ 9 files changed, 220 insertions(+), 116 deletions(-) create mode 100644 net-mgmt/nagios/files/DEINSTALL.tmpl create mode 100644 net-mgmt/nagios/files/INSTALL.tmpl create mode 100644 net-mgmt/nagios/files/MESSAGE.tmpl create mode 100644 net-mgmt/nagios/files/nagios.sh.tmpl delete mode 100644 net-mgmt/nagios/files/patch-aj delete mode 100644 net-mgmt/nagios/pkg-install (limited to 'net-mgmt/nagios') diff --git a/net-mgmt/nagios/Makefile b/net-mgmt/nagios/Makefile index 8f95cbd5cf39..8f392733e2fa 100644 --- a/net-mgmt/nagios/Makefile +++ b/net-mgmt/nagios/Makefile @@ -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 @@ RUN_DEPENDS= ${LOCALBASE}/libexec/nagios/check_nagios:${PORTSDIR}/net/nagios-plu 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 @@ INCGD= -I${LOCALBASE}/include 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 @@ CONFIGURE_ARGS+=--with-pgsql-lib=${LOCALBASE}/pgsql \ --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 diff --git a/net-mgmt/nagios/distinfo b/net-mgmt/nagios/distinfo index f17e0d16ab3a..5b8482cbb29e 100644 --- a/net-mgmt/nagios/distinfo +++ b/net-mgmt/nagios/distinfo @@ -1 +1 @@ -MD5 (nagios-1.1.tar.gz) = 5f48ecd9bad2c4d7c9d88d0b6f347ecf +MD5 (nagios-1.2.tar.gz) = 414d70e5269d5b8d7c21bf3ee129309f diff --git a/net-mgmt/nagios/files/DEINSTALL.tmpl b/net-mgmt/nagios/files/DEINSTALL.tmpl new file mode 100644 index 000000000000..93ed52b4d017 --- /dev/null +++ b/net-mgmt/nagios/files/DEINSTALL.tmpl @@ -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 --git a/net-mgmt/nagios/files/INSTALL.tmpl b/net-mgmt/nagios/files/INSTALL.tmpl new file mode 100644 index 000000000000..da8b7ef5e100 --- /dev/null +++ b/net-mgmt/nagios/files/INSTALL.tmpl @@ -0,0 +1,67 @@ +#!/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 new file mode 100644 index 000000000000..a96b0d6243c3 --- /dev/null +++ b/net-mgmt/nagios/files/MESSAGE.tmpl @@ -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 --git a/net-mgmt/nagios/files/nagios.sh.tmpl b/net-mgmt/nagios/files/nagios.sh.tmpl new file mode 100644 index 000000000000..d3cd0691f819 --- /dev/null +++ b/net-mgmt/nagios/files/nagios.sh.tmpl @@ -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 --git a/net-mgmt/nagios/files/patch-ad b/net-mgmt/nagios/files/patch-ad index 10c3db33738b..4518f5907c41 100644 --- a/net-mgmt/nagios/files/patch-ad +++ b/net-mgmt/nagios/files/patch-ad @@ -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 <&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 --git a/net-mgmt/nagios/files/patch-aj b/net-mgmt/nagios/files/patch-aj deleted file mode 100644 index 06a28e042bdf..000000000000 --- a/net-mgmt/nagios/files/patch-aj +++ /dev/null @@ -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("\n"); - printf("\n"); - -- /* - printf("\n"); - printf("\n"); -- */ - - printf("\n"); - diff --git a/net-mgmt/nagios/pkg-install b/net-mgmt/nagios/pkg-install deleted file mode 100644 index dbc6461bb05e..000000000000 --- a/net-mgmt/nagios/pkg-install +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -# -# $FreeBSD$ -# - -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 -- cgit v1.2.3