[Pkg-nagios-changes] [pkg-nagios] r27 - nagios2/trunk/debian

Marc Haber zugschlus at costa.debian.org
Thu Dec 22 00:21:16 UTC 2005


Author: zugschlus
Date: 2005-12-22 00:21:15 +0000 (Thu, 22 Dec 2005)
New Revision: 27

Added:
   nagios2/trunk/debian/cfg-cgi.cfg.diff
   nagios2/trunk/debian/cfg-checkcommands.cfg.diff
   nagios2/trunk/debian/cfg-local.cfg.diff
   nagios2/trunk/debian/cfg-misccommands.cfg.diff
   nagios2/trunk/debian/cfg-nagios.cfg.diff
   nagios2/trunk/debian/cfg-resource.cfg.diff
   nagios2/trunk/debian/nagios2-common.install
Modified:
   nagios2/trunk/debian/nagios2-common.nagios2.init
   nagios2/trunk/debian/nagios2-common.postinst
   nagios2/trunk/debian/rules
Log:
introduce Debian configuration mechanism
move upstream sample config to /usr/share/doc/nagios2-common/examples
move localstatedir to /var/lib
fix Account name in configure call and init script
fix postinst script to only start daemon once
chown /var directories to correct account in postinst



Added: nagios2/trunk/debian/cfg-cgi.cfg.diff
===================================================================
--- nagios2/trunk/debian/cfg-cgi.cfg.diff	2005-12-22 00:18:56 UTC (rev 26)
+++ nagios2/trunk/debian/cfg-cgi.cfg.diff	2005-12-22 00:21:15 UTC (rev 27)
@@ -0,0 +1,21 @@
+--- sample-config/cgi.cfg	2005-12-21 19:52:44.274923000 +0000
++++ debian-configs/cgi.cfg	2005-12-21 19:53:49.811018750 +0000
+@@ -1,8 +1,6 @@
+ #################################################################
+ #
+-# CGI.CFG - Sample CGI Configuration File for Nagios 
+-#
+-# Last Modified: 05-05-2005
++# CGI.CFG - CGI Configuration File for Nagios 
+ #
+ #################################################################
+ 
+@@ -62,7 +60,7 @@
+ # have to be tweaked a bit, as different versions of the plugin
+ # use different command line arguments/syntaxes.
+ 
+-#nagios_check_command=/usr/lib/nagios/plugins/check_nagios /var/lib/nagios/status.dat 5 '/usr/sbin/nagios'
++nagios_check_command=/usr/lib/nagios/plugins/check_nagios /var/lib/nagios/status.dat 5 '/usr/sbin/nagios'
+ 
+ 
+ 

Added: nagios2/trunk/debian/cfg-checkcommands.cfg.diff
===================================================================
--- nagios2/trunk/debian/cfg-checkcommands.cfg.diff	2005-12-22 00:18:56 UTC (rev 26)
+++ nagios2/trunk/debian/cfg-checkcommands.cfg.diff	2005-12-22 00:21:15 UTC (rev 27)
@@ -0,0 +1,41 @@
+--- sample-config/template-object/checkcommands.cfg	2005-12-21 19:52:44.314925500 +0000
++++ debian-configs/checkcommands.cfg	2005-12-21 19:53:32.413931500 +0000
+@@ -1,12 +1,5 @@
+ ################################################################################
+-# Sample object config file for Nagios 
+-#
+-# Read the documentation for more information on this configuration file.  I've
+-# provided some comments here, but things may not be so clear without further
+-# explanation, so make sure to read the HTML documentation!
+-# 
+-# Last Modified: 06-09-2002
+-#
++# Object config file for Nagios 
+ ################################################################################
+ 
+ 
+@@ -38,11 +31,11 @@
+ 
+ ################################################################################
+ #
+-# SAMPLE SERVICE CHECK COMMANDS
++# SERVICE CHECK COMMANDS
+ #
+-# These are some example service check commands.  They may or may not work on
+-# your system, as they must be modified for your plugins.  See the HTML 
+-# documentation on the plugins for examples of how to configure command definitions.
++# These service check commands may or may not work on your system, as they
++# must be modified for your plugins.  See the HTML documentation on the
++# plugins for examples of how to configure command definitions.
+ #
+ ################################################################################
+ 
+@@ -156,7 +149,7 @@
+ 
+ ################################################################################
+ #
+-# SAMPLE HOST CHECK COMMANDS
++# HOST CHECK COMMANDS
+ #
+ ################################################################################
+ 

Added: nagios2/trunk/debian/cfg-local.cfg.diff
===================================================================
--- nagios2/trunk/debian/cfg-local.cfg.diff	2005-12-22 00:18:56 UTC (rev 26)
+++ nagios2/trunk/debian/cfg-local.cfg.diff	2005-12-22 00:21:15 UTC (rev 27)
@@ -0,0 +1,273 @@
+--- sample-config/template-object/local.cfg	1970-01-01 00:00:00.000000000 +0000
++++ debian-configs/local.cfg	2005-12-21 19:53:32.429932500 +0000
+@@ -0,0 +1,270 @@
++###############################################################################
++# LOCAL.CFG
++#
++# OBJECT CONFIG FILE for the local installation
++#
++###############################################################################
++
++
++
++###############################################################################
++###############################################################################
++#
++# TIME PERIODS
++#
++###############################################################################
++###############################################################################
++
++# This defines a timeperiod where all times are valid for checks, 
++# notifications, etc.  The classic "24x7" support nightmare. :-)
++
++define timeperiod{
++        timeperiod_name 24x7
++        alias           24 Hours A Day, 7 Days A Week
++        sunday          00:00-24:00
++        monday          00:00-24:00
++        tuesday         00:00-24:00
++        wednesday       00:00-24:00
++        thursday        00:00-24:00
++        friday          00:00-24:00
++        saturday        00:00-24:00
++        }
++
++
++
++###############################################################################
++###############################################################################
++#
++# CONTACTS
++#
++###############################################################################
++###############################################################################
++
++# In this simple config file, a single contact will receive all alerts.
++
++define contact{
++        contact_name                    root
++        alias                           Root
++        service_notification_period     24x7
++        host_notification_period        24x7
++        service_notification_options    w,u,c,r
++        host_notification_options       d,r
++        service_notification_commands   notify-by-email
++        host_notification_commands      host-notify-by-email
++        email                           root at localhost
++        }
++
++
++
++###############################################################################
++###############################################################################
++#
++# CONTACT GROUPS
++#
++###############################################################################
++###############################################################################
++
++# We only have one contact in this simple configuration file, so there is
++# no need to create more than one contact group.
++
++define contactgroup{
++        contactgroup_name       admins
++        alias                   Nagios Administrators
++        members                 root
++        }
++
++
++
++###############################################################################
++###############################################################################
++#
++# HOSTS
++#
++###############################################################################
++###############################################################################
++
++# Generic host definition template - This is NOT a real host, just a template!
++
++define host{
++        name                            generic-host    ; The name of this host template
++        notifications_enabled           1       ; Host notifications are enabled
++        event_handler_enabled           1       ; Host event handler is enabled
++        flap_detection_enabled          1       ; Flap detection is enabled
++        failure_prediction_enabled      1       ; Failure prediction is enabled
++        process_perf_data               1       ; Process performance data
++        retain_status_information       1       ; Retain status information across program restarts
++        retain_nonstatus_information    1       ; Retain non-status information across program restarts
++        register                        0       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
++        }
++
++
++# Since this is a simple configuration file, we only monitor one host - the
++# local host (this machine).
++
++define host{
++        use                     generic-host            ; Name of host template to use
++        host_name               localhost
++        alias                   localhost
++        address                 127.0.0.1
++        check_command           check-host-alive
++        max_check_attempts      10
++        notification_interval   120
++        notification_period     24x7
++        notification_options    d,r
++        contact_groups  admins
++        }
++
++
++
++###############################################################################
++###############################################################################
++#
++# HOST GROUPS
++#
++###############################################################################
++###############################################################################
++
++# We only have one host in our simple config file, so there is no need to
++# create more than one hostgroup.
++
++define hostgroup{
++        hostgroup_name  localhost
++        alias           The local host
++        members         localhost
++        }
++
++
++
++###############################################################################
++###############################################################################
++#
++# SERVICES
++#
++###############################################################################
++###############################################################################
++
++# Generic service definition template - This is NOT a real service, just a template!
++
++define service{
++        name                            generic-service ; The 'name' of this service template
++        active_checks_enabled           1       ; Active service checks are enabled
++        passive_checks_enabled          1       ; Passive service checks are enabled/accepted
++        parallelize_check               1       ; Active service checks should be parallelized (disabling this can lead to major performance problems)
++        obsess_over_service             1       ; We should obsess over this service (if necessary)
++        check_freshness                 0       ; Default is to NOT check service 'freshness'
++        notifications_enabled           1       ; Service notifications are enabled
++        event_handler_enabled           1       ; Service event handler is enabled
++        flap_detection_enabled          1       ; Flap detection is enabled
++        failure_prediction_enabled      1       ; Failure prediction is enabled
++        process_perf_data               1       ; Process performance data
++        retain_status_information       1       ; Retain status information across program restarts
++        retain_nonstatus_information    1       ; Retain non-status information across program restarts
++        register                        0       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
++        }
++
++
++# Define a service to "ping" the local machine
++
++define service{
++        use                             generic-service         ; Name of service template to use
++        host_name                       localhost
++        service_description             PING
++        is_volatile                     0
++        check_period                    24x7
++        max_check_attempts              4
++        normal_check_interval           5
++        retry_check_interval            1
++        contact_groups                  admins
++	notification_options		w,u,c,r
++        notification_interval           960
++        notification_period             24x7
++	check_command			check_ping!100.0,20%!500.0,60%
++        }
++
++
++# Define a service to check the disk space of the root partition
++# on the local machine.  Warning if < 20% free, critical if
++# < 10% free space on partition.
++
++define service{
++        use                             generic-service         ; Name of service template to use
++        host_name                       localhost
++        service_description             Root Partition
++        is_volatile                     0
++        check_period                    24x7
++        max_check_attempts              4
++        normal_check_interval           5
++        retry_check_interval            1
++        contact_groups                  admins
++	notification_options		w,u,c,r
++        notification_interval           960
++        notification_period             24x7
++	check_command			check_local_disk!20%!10%!/
++        }
++
++
++
++# Define a service to check the number of currently logged in
++# users on the local machine.  Warning if > 20 users, critical
++# if > 50 users.
++
++define service{
++        use                             generic-service         ; Name of service template to use
++        host_name                       localhost
++        service_description             Current Users
++        is_volatile                     0
++        check_period                    24x7
++        max_check_attempts              4
++        normal_check_interval           5
++        retry_check_interval            1
++        contact_groups                  admins
++	notification_options		w,u,c,r
++        notification_interval           960
++        notification_period             24x7
++	check_command			check_local_users!20!50
++        }
++
++
++# Define a service to check the number of currently running procs
++# on the local machine.  Warning if > 250 processes, critical if
++# > 400 users.
++
++define service{
++        use                             generic-service         ; Name of service template to use
++        host_name                       localhost
++        service_description             Total Processes
++        is_volatile                     0
++        check_period                    24x7
++        max_check_attempts              4
++        normal_check_interval           5
++        retry_check_interval            1
++        contact_groups                  admins
++	notification_options		w,u,c,r
++        notification_interval           960
++        notification_period             24x7
++	check_command			check_local_procs!250!400
++        }
++
++
++
++# Define a service to check the load on the local machine. 
++
++define service{
++        use                             generic-service         ; Name of service template to use
++        host_name                       localhost
++        service_description             Current Load
++        is_volatile                     0
++        check_period                    24x7
++        max_check_attempts              4
++        normal_check_interval           5
++        retry_check_interval            1
++        contact_groups                  admins
++	notification_options		w,u,c,r
++        notification_interval           960
++        notification_period             24x7
++	check_command			check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
++        }
++
++
++
++# EOF

Added: nagios2/trunk/debian/cfg-misccommands.cfg.diff
===================================================================
--- nagios2/trunk/debian/cfg-misccommands.cfg.diff	2005-12-22 00:18:56 UTC (rev 26)
+++ nagios2/trunk/debian/cfg-misccommands.cfg.diff	2005-12-22 00:21:15 UTC (rev 27)
@@ -0,0 +1,65 @@
+--- sample-config/template-object/misccommands.cfg	2005-12-21 19:52:44.322926000 +0000
++++ debian-configs/misccommands.cfg	2005-12-21 19:53:32.501937000 +0000
+@@ -1,12 +1,5 @@
+ ################################################################################
+-# Sample object config file for Nagios 
+-#
+-# Read the documentation for more information on this configuration file.  I've
+-# provided some comments here, but things may not be so clear without further
+-# explanation, so make sure to read the HTML documentation!
+-# 
+-# Last Modified: 03-14-2005
+-#
++# Object config file for Nagios 
+ ################################################################################
+ 
+ 
+@@ -38,10 +31,7 @@
+ 
+ ################################################################################
+ #
+-# SAMPLE NOTIFICATION COMMANDS
+-#
+-# These are some example notification commands.  They may or may not work on
+-# your system without modification.
++# NOTIFICATION COMMANDS
+ #
+ ################################################################################
+ 
+@@ -53,13 +43,6 @@
+ 	}
+ 
+ 
+-# 'notify-by-epager' command definition
+-define command{
+-	command_name	notify-by-epager
+-	command_line	/usr/bin/printf "%b" "Service: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo: $SERVICEOUTPUT$\nDate: $LONGDATETIME$" | /usr/bin/mail -s "$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTPAGER$
+-	}
+-
+-
+ # 'host-notify-by-email' command definition
+ define command{
+ 	command_name	host-notify-by-email
+@@ -67,20 +50,13 @@
+ 	}
+ 
+ 
+-# 'host-notify-by-epager' command definition
+-define command{
+-	command_name	host-notify-by-epager
+-	command_line	/usr/bin/printf "%b" "Host '$HOSTALIAS$' is $HOSTSTATE$\nInfo: $HOSTOUTPUT$\nTime: $LONGDATETIME$" | /usr/bin/mail -s "$NOTIFICATIONTYPE$ alert - Host $HOSTNAME$ is $HOSTSTATE$" $CONTACTPAGER$
+-	}
+-
+-
+ 
+ 
+ ################################################################################
+ #
+-# SAMPLE PERFORMANCE DATA COMMANDS
++# PERFORMANCE DATA COMMANDS
+ #
+-# These are sample performance data commands that can be used to send performance
++# These are performance data commands that are be used to send performance
+ # data output to two text files (one for hosts, another for services).  If you
+ # plan on simply writing performance data out to a file, consider using the 
+ # host_perfdata_file and service_perfdata_file options in the main config file.

Added: nagios2/trunk/debian/cfg-nagios.cfg.diff
===================================================================
--- nagios2/trunk/debian/cfg-nagios.cfg.diff	2005-12-22 00:18:56 UTC (rev 26)
+++ nagios2/trunk/debian/cfg-nagios.cfg.diff	2005-12-22 00:21:15 UTC (rev 27)
@@ -0,0 +1,105 @@
+--- sample-config/nagios.cfg	2005-12-21 19:52:44.242921000 +0000
++++ debian-configs/nagios.cfg	2005-12-21 19:55:51.382616500 +0000
+@@ -1,12 +1,6 @@
+ ##############################################################################
+ #
+-# NAGIOS.CFG - Sample Main Config File for Nagios 
+-#
+-# Read the documentation for more information on this configuration
+-# file.  I've provided some comments here, but things may not be so
+-# clear without further explanation.
+-#
+-# Last Modified: 11-23-2005
++# NAGIOS.CFG - Main Config File for Nagios 
+ #
+ ##############################################################################
+ 
+@@ -40,11 +34,13 @@
+ cfg_file=/etc/nagios/misccommands.cfg
+ 
+ # You can split other types of object definitions across several
+-# config files if you wish (as done here), or keep them all in a
+-# single config file.
++# config files if you wish, or keep them all in a single config file.
+ 
+-cfg_file=/etc/nagios/minimal.cfg
++# default file shipped with Debian
++cfg_file=/etc/nagios/local.cfg
+ 
++# suggested scheme of splitting definition across several config files,
++# suitable for larger installations.
+ #cfg_file=/etc/nagios/contactgroups.cfg
+ #cfg_file=/etc/nagios/contacts.cfg
+ #cfg_file=/etc/nagios/dependencies.cfg
+@@ -77,7 +73,7 @@
+ # directly) in order to prevent inconsistencies that can occur
+ # when the config files are modified after Nagios starts.
+ 
+-object_cache_file=/var/lib/nagios/objects.cache
++object_cache_file=/var/cache/nagios/objects.cache
+ 
+ 
+ 
+@@ -100,7 +96,7 @@
+ # The contents of the status file are deleted every time Nagios
+ #  restarts.
+ 
+-status_file=/var/lib/nagios/status.dat
++status_file=/var/cache/nagios/status.dat
+ 
+ 
+ 
+@@ -159,7 +155,7 @@
+ # directory level instead of on the file, as the file is deleted every
+ # time its contents are processed.
+ 
+-command_file=/var/lib/nagios/rw/nagios.cmd
++command_file=/var/cache/nagios/rw/nagios.cmd
+ 
+ 
+ 
+@@ -167,7 +163,7 @@
+ # This is the file that Nagios will use for storing host and service
+ # comments.
+ 
+-comment_file=/var/lib/nagios/comments.dat
++comment_file=/var/cache/nagios/comments.dat
+ 
+ 
+ 
+@@ -175,7 +171,7 @@
+ # This is the file that Nagios will use for storing host and service
+ # downtime data.
+ 
+-downtime_file=/var/lib/nagios/downtime.dat
++downtime_file=/var/cache/nagios/downtime.dat
+ 
+ 
+ 
+@@ -193,7 +189,7 @@
+ # is created, used, and deleted throughout the time that Nagios is
+ # running.
+ 
+-temp_file=/var/lib/nagios/nagios.tmp
++temp_file=/var/cache/nagios/nagios.tmp
+ 
+ 
+ 
+@@ -925,7 +921,7 @@
+ # you can access this value by using the $ADMINEMAIL$ macro in your
+ # notification commands.
+ 
+-admin_email=Debian-nagios2
++admin_email=root
+ 
+ 
+ 
+@@ -935,7 +931,7 @@
+ # value by using the $ADMINPAGER$ macro in your notification
+ # commands.
+ 
+-admin_pager=pageDebian-nagios2
++admin_pager=pageroot
+ 
+ 
+ 

Added: nagios2/trunk/debian/cfg-resource.cfg.diff
===================================================================
--- nagios2/trunk/debian/cfg-resource.cfg.diff	2005-12-22 00:18:56 UTC (rev 26)
+++ nagios2/trunk/debian/cfg-resource.cfg.diff	2005-12-22 00:21:15 UTC (rev 27)
@@ -0,0 +1,17 @@
+--- sample-config/resource.cfg	2005-12-21 16:36:52.510157274 +0000
++++ debian-configs/resource.cfg	2005-12-21 16:40:01.992778275 +0000
+@@ -1,8 +1,6 @@
+ ###########################################################################
+ #
+-# RESOURCE.CFG - Sample Resource File for Nagios 
+-#
+-# Last Modified: 09-10-2003
++# RESOURCE.CFG - Resource File for Nagios 
+ #
+ # You can define $USERx$ macros in this file, which can in turn be used
+ # in command definitions in your host config file(s).  $USERx$ macros are
+@@ -31,4 +29,3 @@
+ # Store some usernames and passwords (hidden from the CGIs)
+ #$USER3$=someuser
+ #$USER4$=somepassword
+-

Added: nagios2/trunk/debian/nagios2-common.install
===================================================================
--- nagios2/trunk/debian/nagios2-common.install	2005-12-22 00:18:56 UTC (rev 26)
+++ nagios2/trunk/debian/nagios2-common.install	2005-12-22 00:21:15 UTC (rev 27)
@@ -0,0 +1,5 @@
+debian-configs/* /etc/nagios
+sample-config/README /usr/share/doc/examples
+sample-config/*.cfg /usr/share/doc/examples
+sample-config/template-object/README /usr/share/doc/examples/template-object
+sample-config/template-object/*.cfg /usr/share/doc/examples/template-object

Modified: nagios2/trunk/debian/nagios2-common.nagios2.init
===================================================================
--- nagios2/trunk/debian/nagios2-common.nagios2.init	2005-12-22 00:18:56 UTC (rev 26)
+++ nagios2/trunk/debian/nagios2-common.nagios2.init	2005-12-22 00:21:15 UTC (rev 27)
@@ -60,10 +60,6 @@
     log_file="$(get_config log_file)"
     log_dir="$(dirname $log_file)"
 
-    # Chown the log directory to this user/group so that
-    # Nagios can write there.
-    chown -R ${nagios_user}:$nagios_group $log_dir
-
     return 0    # Config is ok
   else
     # config is not okay, so let's barf the error to the user

Modified: nagios2/trunk/debian/nagios2-common.postinst
===================================================================
--- nagios2/trunk/debian/nagios2-common.postinst	2005-12-22 00:18:56 UTC (rev 26)
+++ nagios2/trunk/debian/nagios2-common.postinst	2005-12-22 00:21:15 UTC (rev 27)
@@ -1,15 +1,29 @@
 #!/bin/bash
 
-if [ "$1" = "configure" ] &&\
-        ! getent passwd Debian-nagios2 > /dev/null ; then
-        echo 'Adding system-user for nagios2' 1>&2
-        adduser --system --group --home /var/run/nagios --no-create-home \
-                --disabled-login --force-badname Debian-nagios2 > /dev/null
-fi
+set -e
 
-if [ "$1" = "configure" ]; then
-	chown root:Debian-nagios /etc/nagios/resource.cfg
-	chmod 640 /etc/nagios/resource.cfg
-fi
+case "$1" in
+  configure)
+    if ! getent passwd Debian-nagios2 > /dev/null ; then
+      echo 'Adding system-user for nagios2' 1>&2
+      adduser --system --group --home /var/run/nagios --no-create-home \
+              --disabled-login --force-badname Debian-nagios2 > /dev/null
+    fi
 
+    chown root:Debian-nagios2 /etc/nagios/resource.cfg
+    chmod 640 /etc/nagios/resource.cfg
+    install -d -oDebian-nagios2 -gadm -m2750 /var/log/nagios
+    install -d -oDebian-nagios2 -gDebian-nagios2 -m750 /var/run/nagios
+    install -d -oDebian-nagios2 -gDebian-nagios2 -m750 /var/lib/nagios
+    install -d -oDebian-nagios2 -gDebian-nagios2 -m750 /var/lib/nagios/rw
+    install -d -oDebian-nagios2 -gDebian-nagios2 -m750 /var/cache/nagios
+    ;;
+  abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+  *)
+    echo "postinst called with unknown argument \$1'" >&2
+    exit 1
+    ;;
+esac
+
 #DEBHELPER#

Modified: nagios2/trunk/debian/rules
===================================================================
--- nagios2/trunk/debian/rules	2005-12-22 00:18:56 UTC (rev 26)
+++ nagios2/trunk/debian/rules	2005-12-22 00:21:15 UTC (rev 27)
@@ -5,7 +5,6 @@
 
 # export DH_VERBOSE=1
 
-
 b := $(shell pwd)/debian
 
 export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
@@ -29,13 +28,13 @@
 				--sysconfdir=/etc/nagios \
 				--infodir=/usr/share/info \
 				--libexecdir=/usr/lib/nagios/plugins \
-				--localstatedir=/var/log/nagios \
+				--localstatedir=/var/lib/nagios \
 				--enable-event-broker \
 				--enable-embedded-perl \
-				--with-nagios-user=Debian-nagios \
-				--with-nagios-group=Debian-nagios \
-				--with-command-user=Debian-nagios \
-				--with-command-group=Debian-nagios \
+				--with-nagios-user=Debian-nagios2 \
+				--with-nagios-group=Debian-nagios2 \
+				--with-command-user=Debian-nagios2 \
+				--with-command-group=Debian-nagios2 \
 				--with-init-dir=/etc/init.d \
 				--with-lockfile=/var/run/nagios/nagios.pid \
 				--with-mail=/usr/bin/mail \
@@ -43,6 +42,37 @@
 				--build=$(DEB_BUILD_GNU_TYPE) \
 				--host=$(DEB_HOST_GNU_TYPE) 
 
+unpack-configs: unpack-configs-stamp
+unpack-configs-stamp: configure-stamp
+	mkdir -p debian-configs
+	-for cfg in $$(ls debian/cfg-*.diff); do \
+	  TARGETNAME=$$(basename $$cfg .diff | sed 's/^cfg-//'); \
+	  echo $$TARGETNAME; \
+	  DISTNAME="sample-config/$$TARGETNAME"; \
+	  if ! [ -e "$$DISTNAME" ]; then \
+	    DISTNAME="sample-config/template-object/$$TARGETNAME"; \
+	  fi; \
+	  echo patch -o debian-configs/$$TARGETNAME $$DISTNAME $$cfg; \
+	  patch -o debian-configs/$$TARGETNAME $$DISTNAME $$cfg; \
+	done; \
+	if [ -e "debian-configs/*.rej" ]; then \
+	  echo "diffs to config file didn't match. Stop."; \
+	  exit 1; \
+	fi
+	touch unpack-configs-stamp
+
+pack-configs: patch
+	-for cfg in $$(ls debian-configs/*); do \
+	  TARGETNAME=$$(basename $$cfg); \
+	  DISTNAME="sample-config/$$TARGETNAME"; \
+	  if ! [ -e "$$DISTNAME" ]; then \
+	    DISTNAME="sample-config/template-object/$$TARGETNAME"; \
+	  fi; \
+	  echo diff -u $$DISTNAME $$cfg; \
+	  diff -uN $$DISTNAME $$cfg > debian/cfg-$${TARGETNAME}.diff || true; \
+	done
+	rm -f unpack-configs-stamp
+
 clean: clean-patched unpatch
 clean-patched:
 	dh_testdir -a
@@ -50,7 +80,8 @@
 	#-rm -Rf docs examples {build,config}-nagios-{text,pgsql,mysql}-stamp
 	if test -f Makefile; then make distclean; fi
 	#-rm -Rf {cgi,base}/*.{mysql,pgsql,text}
-	rm -f {patch,install,configure,build}-stamp
+	rm -f {patch,install,configure,build,unpack-configs}-stamp
+	rm -rf debian-configs
 	#-rm debian/templates.merged subst
 	dh_clean
 	#debconf-updatepo
@@ -82,7 +113,7 @@
 	rm -rf patch-stamp debian/patched
 
 install: install-stamp
-install-stamp: build-stamp
+install-stamp: build-stamp unpack-configs-stamp
 	@echo "Doing $@"
 	dh_testdir -a
 	dh_testroot -a
@@ -90,12 +121,10 @@
 	# zero out INSTALL_OPTS to prevent chowning at build-time
 	make install DESTDIR=$b/nagios2 INSTALL_OPTS=""
 	# move some arch-indep stuff to the nagios2-common package
-	mv $b/nagios2/usr/share/nagios $b/nagios2-common/usr/share/
-	mv $b/nagios2/var/log $b/nagios2-common/var
-	rmdir $b/nagios2/var
-	# put the config files in place
-	cp sample-config/*cfg $b/nagios2-common/etc/nagios
-	cp sample-config/template-object/misccommands.cfg $b/nagios2-common/etc/nagios
+	cp -a $b/nagios2/usr/share/nagios $b/nagios2-common/usr/share/
+	rm -rf $b/nagios2/usr/share/nagios
+	# remove empty directory
+	rmdir --ignore-fail-on-non-empty -p $b/nagios2/var/lib/nagios/archives
 	dh_link -a
 	touch install-stamp
 
@@ -104,6 +133,7 @@
 	@echo "Doing $@"
 	dh_testdir           -a
 	dh_testroot          -a
+	dh_install           -a
 	dh_strip             -a
 	dh_compress          -a
 	dh_fixperms          -a
@@ -119,14 +149,10 @@
 	dh_installexamples   -i
 	dh_installchangelogs -i
 	# XXX some stuff below here is commented out
-	#dh_install           -i
+	dh_install           -i
 	#install -m 755 cgi/grouplist.cgi.in debian/$@/usr/lib/cgi-bin/nagios/grouplist.cgi
 	# they install it themselves now?
 	dh_installinit 	     --name nagios2 -- defaults 30 18
-	#chmod +x debian/nagios2-common/usr/lib/nagios/plugins/check-imap
-	#chmod +x debian/nagios2-common/usr/lib/cgi-bin/nagios/traceroute.cgi
-	chmod 600 debian/nagios2-common/etc/nagios/resource.cfg
-	#rm -f debian/nagios2-common/etc/nagios/hosts.cfg
 	dh_link              -i usr/share/nagios2-common/htdocs/docs usr/share/doc/nagios2-common/html
 	dh_compress          -i
 	dh_fixperms          -i -Xnagios2/resource.cfg




More information about the Pkg-nagios-changes mailing list