diff options
Diffstat (limited to 'net-mgmt/nagios2/files')
-rw-r--r-- | net-mgmt/nagios2/files/DEINSTALL.tmpl | 23 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/INSTALL.tmpl | 67 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/MESSAGE.tmpl | 15 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/nagios.sh.in | 62 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/nagios.sh.tmpl | 71 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/patch-Makefile.in | 13 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/patch-base-utils.c | 11 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/patch-contrib-Makefile.in | 17 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/pkg-deinstall.in | 22 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/pkg-install.in | 69 | ||||
-rw-r--r-- | net-mgmt/nagios2/files/pkg-message.in | 29 |
11 files changed, 221 insertions, 178 deletions
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%%/ + +********************************************************************** |