diff options
author | linimon <linimon@FreeBSD.org> | 2004-02-11 12:56:00 +0800 |
---|---|---|
committer | linimon <linimon@FreeBSD.org> | 2004-02-11 12:56:00 +0800 |
commit | 4b4448a8b6c143315c98e78ada4bdffdaefc77c7 (patch) | |
tree | 7bc6ba73dc84751c61825cb60020ba2a1b9122fd /net-mgmt/nagios2 | |
parent | a1270e3d1314454cac3bb929690f045172423b25 (diff) | |
download | freebsd-ports-gnome-4b4448a8b6c143315c98e78ada4bdffdaefc77c7.tar.gz freebsd-ports-gnome-4b4448a8b6c143315c98e78ada4bdffdaefc77c7.tar.zst freebsd-ports-gnome-4b4448a8b6c143315c98e78ada4bdffdaefc77c7.zip |
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 <blaz@si.FreeBSD.org> (maintainer)
Diffstat (limited to 'net-mgmt/nagios2')
-rw-r--r-- | net-mgmt/nagios2/Makefile | 61 | ||||
-rw-r--r-- | net-mgmt/nagios2/distinfo | 2 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/DEINSTALL.tmpl | 23 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/INSTALL.tmpl (renamed from net-mgmt/nagios2/pkg-install) | 25 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/MESSAGE.tmpl | 15 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/nagios.sh.tmpl | 55 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/patch-ad | 32 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/patch-aj | 13 |
8 files changed, 165 insertions, 61 deletions
diff --git a/net-mgmt/nagios2/Makefile b/net-mgmt/nagios2/Makefile index 8f95cbd5cf39..8f392733e2fa 100644 --- a/net-mgmt/nagios2/Makefile +++ b/net-mgmt/nagios2/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 <bsd.port.mk> diff --git a/net-mgmt/nagios2/distinfo b/net-mgmt/nagios2/distinfo index f17e0d16ab3a..5b8482cbb29e 100644 --- a/net-mgmt/nagios2/distinfo +++ b/net-mgmt/nagios2/distinfo @@ -1 +1 @@ -MD5 (nagios-1.1.tar.gz) = 5f48ecd9bad2c4d7c9d88d0b6f347ecf +MD5 (nagios-1.2.tar.gz) = 414d70e5269d5b8d7c21bf3ee129309f diff --git a/net-mgmt/nagios2/files/DEINSTALL.tmpl b/net-mgmt/nagios2/files/DEINSTALL.tmpl new file mode 100644 index 000000000000..93ed52b4d017 --- /dev/null +++ b/net-mgmt/nagios2/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/nagios2/pkg-install b/net-mgmt/nagios2/files/INSTALL.tmpl index dbc6461bb05e..7ef71df5d57f 100644 --- a/net-mgmt/nagios2/pkg-install +++ b/net-mgmt/nagios2/files/INSTALL.tmpl @@ -1,12 +1,11 @@ #!/bin/sh # -# $FreeBSD$ +# $FreeBSD: /tmp/pcvs/ports/net-mgmt/nagios2/files/Attic/INSTALL.tmpl,v 1.1 2004-02-11 04:56:00 linimon Exp $ # -PKG_PREFIX=${PKG_PREFIX:=/usr/local} - -user=nagios -group=nagios +USER=%%NAGIOSUSER%% +GROUP=%%NAGIOSGROUP%% +DIR=%%NAGIOSDIR%% ask() { local question default answer @@ -38,12 +37,12 @@ yesno() { } 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." + 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}\"." + echo "You need a group \"${GROUP}\"." if yesno "Would you like me to create it" y; then - /usr/sbin/pw groupadd ${group} -h - || exit + /usr/sbin/pw groupadd ${GROUP} -h - || exit echo "Done." else echo "Please create it, and try again." @@ -51,12 +50,12 @@ if [ x"$2" = xPRE-INSTALL ]; then 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." + 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}\"." + 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 \ + /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - -d ${DIR} \ -s /nonexistent -c "Nagios pseudo-user" || exit echo "Done." else diff --git a/net-mgmt/nagios2/files/MESSAGE.tmpl b/net-mgmt/nagios2/files/MESSAGE.tmpl new file mode 100644 index 000000000000..a96b0d6243c3 --- /dev/null +++ b/net-mgmt/nagios2/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/nagios2/files/nagios.sh.tmpl b/net-mgmt/nagios2/files/nagios.sh.tmpl new file mode 100644 index 000000000000..d3cd0691f819 --- /dev/null +++ b/net-mgmt/nagios2/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/nagios2/files/patch-ad b/net-mgmt/nagios2/files/patch-ad index 10c3db33738b..4518f5907c41 100644 --- a/net-mgmt/nagios2/files/patch-ad +++ b/net-mgmt/nagios2/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 <<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 --git a/net-mgmt/nagios2/files/patch-aj b/net-mgmt/nagios2/files/patch-aj deleted file mode 100644 index 06a28e042bdf..000000000000 --- a/net-mgmt/nagios2/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("</table>\n"); - printf("</td>\n"); - -- /* - printf("</tr>\n"); - printf("</table>\n"); -- */ - - printf("</td>\n"); - |