[Pkg-nagios-changes] [pkg-nagios] r991 - nagios-plugins/trunk/debian

Sean Finney seanius at costa.debian.org
Wed Sep 20 21:28:36 UTC 2006


Author: seanius
Date: 2006-09-20 21:28:35 +0000 (Wed, 20 Sep 2006)
New Revision: 991

Added:
   nagios-plugins/trunk/debian/nagios-plugins-basic.postinst
   nagios-plugins/trunk/debian/nagios-plugins-basic.postrm.in
   nagios-plugins/trunk/debian/nagios-plugins-standard.postinst
   nagios-plugins/trunk/debian/nagios-plugins-standard.postrm.in
Modified:
   nagios-plugins/trunk/debian/changelog
   nagios-plugins/trunk/debian/control
   nagios-plugins/trunk/debian/rules
Log:
first stab at ucf-izing the plugin configs

Modified: nagios-plugins/trunk/debian/changelog
===================================================================
--- nagios-plugins/trunk/debian/changelog	2006-09-19 11:04:15 UTC (rev 990)
+++ nagios-plugins/trunk/debian/changelog	2006-09-20 21:28:35 UTC (rev 991)
@@ -3,6 +3,9 @@
   * NOT RELEASED YET
   * include fix for braindead behaviour in check_tcp based plugins
     such as check_simap (closes: #351847).
+  * dpkg's conffile handling can't deal with migrating config files
+    from nagios-plugins to nagios-plugins-foo, so we're now managing
+    all the config files via ucf (closes: #339971).
 
  -- sean finney <seanius at debian.org>  Sat, 02 Sep 2006 23:03:45 +0200
 

Modified: nagios-plugins/trunk/debian/control
===================================================================
--- nagios-plugins/trunk/debian/control	2006-09-19 11:04:15 UTC (rev 990)
+++ nagios-plugins/trunk/debian/control	2006-09-20 21:28:35 UTC (rev 991)
@@ -30,7 +30,7 @@
 
 Package: nagios-plugins-basic
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, procps, iputils-ping
+Depends: ${shlibs:Depends}, ${misc:Depends}, procps, iputils-ping, ucf
 Conflicts: nagios-plugins (<= 1.4.2-3)
 Replaces: nagios-plugins, nagios-plugins-standard
 Suggests: nagios-text | nagios
@@ -56,7 +56,7 @@
 Architecture: any
 Conflicts: nagios-plugins (<= 1.4.2-3)
 Replaces: nagios-plugins
-Depends: ${shlibs:Depends}, ${misc:Depends}, fping, qstat, snmp, radiusclient1, libnet-snmp-perl, dnsutils, bind9-host | host, smbclient
+Depends: ${shlibs:Depends}, ${misc:Depends}, fping, qstat, snmp, radiusclient1, libnet-snmp-perl, dnsutils, bind9-host | host, smbclient, ucf
 Suggests: nagios-text | nagios
 Description: Plugins for the nagios network monitoring and management system
  Nagios is a host/service/network monitoring and management system. It has

Added: nagios-plugins/trunk/debian/nagios-plugins-basic.postinst
===================================================================
--- nagios-plugins/trunk/debian/nagios-plugins-basic.postinst	                        (rev 0)
+++ nagios-plugins/trunk/debian/nagios-plugins-basic.postinst	2006-09-20 21:28:35 UTC (rev 991)
@@ -0,0 +1,12 @@
+#!/bin/sh -e
+
+if [ "$1" = "configure" ]; then
+	( 
+		cd /usr/share/nagios-plugins/templates-basic
+		for f in *cfg; do
+			ucf $f /etc/nagios-plugins/config/$f 
+		done 
+	);
+fi
+
+#DEBHELPER#

Added: nagios-plugins/trunk/debian/nagios-plugins-basic.postrm.in
===================================================================
--- nagios-plugins/trunk/debian/nagios-plugins-basic.postrm.in	                        (rev 0)
+++ nagios-plugins/trunk/debian/nagios-plugins-basic.postrm.in	2006-09-20 21:28:35 UTC (rev 991)
@@ -0,0 +1,17 @@
+#!/bin/sh -e
+
+BASIC_PLUGINS="@BASIC_PLUGINS@"
+
+if [ "$1" = "purge" ]; then
+	if which ucf >/dev/null 2>&1; then
+		have_ucf="yes"
+	fi
+	for f in $BASIC_PLUGINS; do
+		rm -f /etc/nagios-plugins/config/$f
+		if [ "$have_ucf" = "yes" ]; then
+			ucf --purge /etc/nagios-plugins/config/$f 
+		fi
+	done 
+fi
+
+#DEBHELPER#

Added: nagios-plugins/trunk/debian/nagios-plugins-standard.postinst
===================================================================
--- nagios-plugins/trunk/debian/nagios-plugins-standard.postinst	                        (rev 0)
+++ nagios-plugins/trunk/debian/nagios-plugins-standard.postinst	2006-09-20 21:28:35 UTC (rev 991)
@@ -0,0 +1,12 @@
+#!/bin/sh -e
+
+if [ "$1" = "configure" ]; then
+	( 
+		cd /usr/share/nagios-plugins/templates-standard
+		for f in *cfg; do
+			ucf $f /etc/nagios-plugins/config/$f 
+		done 
+	);
+fi
+
+#DEBHELPER#

Added: nagios-plugins/trunk/debian/nagios-plugins-standard.postrm.in
===================================================================
--- nagios-plugins/trunk/debian/nagios-plugins-standard.postrm.in	                        (rev 0)
+++ nagios-plugins/trunk/debian/nagios-plugins-standard.postrm.in	2006-09-20 21:28:35 UTC (rev 991)
@@ -0,0 +1,17 @@
+#!/bin/sh -e
+
+STD_PLUGINS="@STD_PLUGINS@"
+
+if [ "$1" = "purge" ]; then
+	if which ucf >/dev/null 2>&1; then
+		have_ucf="yes"
+	fi
+	for f in $STD_PLUGINS; do
+		rm -f /etc/nagios-plugins/config/$f
+		if [ "$have_ucf" = "yes" ]; then
+			ucf --purge /etc/nagios-plugins/config/$f 
+		fi
+	done 
+fi
+
+#DEBHELPER#

Modified: nagios-plugins/trunk/debian/rules
===================================================================
--- nagios-plugins/trunk/debian/rules	2006-09-19 11:04:15 UTC (rev 990)
+++ nagios-plugins/trunk/debian/rules	2006-09-20 21:28:35 UTC (rev 991)
@@ -18,17 +18,21 @@
 CFLAGS = -Wall -g
 
 NP_LIBEXEC:=/usr/lib/nagios/plugins
-NP_ETC:=/etc/nagios-plugins/config
 NP_BASIC_DIR:=$(CURDIR)/debian/nagios-plugins-basic
+NP_BASIC_TEMPLATES:=$(NP_BASIC_DIR)/usr/share/nagios-plugins/templates-basic
 NP_STD_DIR:=$(CURDIR)/debian/nagios-plugins-standard
+NP_STD_TEMPLATES:=$(NP_STD_DIR)/usr/share/nagios-plugins/templates-standard
+
 std_plugins:=check_breeze check_ifoperstatus check_hpjd check_ifstatus \
 	check_rpc check_snmp check_wave check_fping check_game \
 	check_radius check_mysql check_mysql_query check_pgsql \
 	check_disk_smb check_ldap check_ldaps \
 	check_dns check_dig check_flexlm check_oracle
-std_plugin_cfgs:=breeze dns flexlm games hppjd ifstatus ldap mrtg mysql \
-	netware nt pgsql radius snmp
 
+basic_plugin_cfgs:=apt dhcp disk dummy ftp http load mail ntp ping procs real \
+	ssh tcp_udp telnet users
+std_plugin_cfgs:=breeze disk-smb dns flexlm fping games hppjd ifstatus ldap \
+	mrtg mysql netware nt pgsql radius rpc-nfs snmp
 
 PATH = /bin:/sbin:/usr/bin:/usr/sbin
 
@@ -65,11 +69,7 @@
 
 build-stamp:  config.status
 	dh_testdir
-
-	# Add here commands to compile the package.
 	$(MAKE)
-	#/usr/bin/docbook-to-man debian/nagios-plugins.sgml > nagios-plugins.1
-
 	touch build-stamp
 
 clean: really-clean unpatch
@@ -85,6 +85,7 @@
 	-rm -f platform.h auto-include.h
 	find -type d -name build -print0 | xargs -0 -r rm -rf \;
 	find \( -name config.sub -o -name config.guess \) -print0 | xargs -0 -r rm -f \;
+	-rm -f debian/nagios-plugins-basic.postrm debian/nagios-plugins-standard.postrm
 	dh_clean 
 
 install: build
@@ -96,15 +97,26 @@
 	# Add here commands to install the package into debian/nagios-plugins.
 	$(MAKE) install DESTDIR=${NP_BASIC_DIR}
 	chmod 644 ${NP_BASIC_DIR}/usr/lib/nagios/plugins/utils.pm
-	cp $(CURDIR)/debian/pluginconfig/*.cfg ${NP_BASIC_DIR}/${NP_ETC}
 	# split up basic vs. standard plugins
 	for p in ${std_plugins}; do \
 		mv ${NP_BASIC_DIR}/${NP_LIBEXEC}/$$p ${NP_STD_DIR}/${NP_LIBEXEC}; \
 	done
-	# now do the same for their configs
+	# now do the same for their configs, copying them into seperate
+	# "template" directories outside of /usr/share/doc for ucf to use.
+	for c in ${basic_plugin_cfgs}; do \
+		cp $(CURDIR)/debian/pluginconfig/$${c}.cfg ${NP_BASIC_TEMPLATES}; \
+	done
 	for c in ${std_plugin_cfgs}; do \
-		mv ${NP_BASIC_DIR}/${NP_ETC}/$${c}.cfg ${NP_STD_DIR}/${NP_ETC}; \
+		cp $(CURDIR)/debian/pluginconfig/$${c}.cfg ${NP_STD_TEMPLATES}; \
 	done
+	# dynamically create the postrm scripts using a template, so that we
+	# don't have to define the same list of plugin configs over and over.
+	sed -e 's/@BASIC_PLUGINS@/${basic_plugin_cfgs}/' \
+		< debian/nagios-plugins-basic.postrm.in \
+		> debian/nagios-plugins-basic.postrm
+	sed -e 's/@STD_PLUGINS@/${std_plugin_cfgs}/' \
+		< debian/nagios-plugins-basic.postrm.in \
+		> debian/nagios-plugins-basic.postrm
 
 
 # Build architecture-independent files here.




More information about the Pkg-nagios-changes mailing list