[Pkg-nagios-changes] [pkg-nagios-plugins] 28/413: first stab at ucf-izing the plugin configs

Jan Wagner waja at moszumanska.debian.org
Tue Nov 26 23:13:02 UTC 2013


This is an automated email from the git hooks/post-receive script.

waja pushed a commit to branch master
in repository pkg-nagios-plugins.

commit 1bc469da673edeb2becbf8bec326ee7fa25829c6
Author: Sean Finney <seanius at debian.org>
Date:   Wed Sep 20 21:28:35 2006 +0000

    first stab at ucf-izing the plugin configs
---
 debian/changelog                         |  3 +++
 debian/control                           |  4 ++--
 debian/nagios-plugins-basic.postinst     | 12 ++++++++++++
 debian/nagios-plugins-basic.postrm.in    | 17 +++++++++++++++++
 debian/nagios-plugins-standard.postinst  | 12 ++++++++++++
 debian/nagios-plugins-standard.postrm.in | 17 +++++++++++++++++
 debian/rules                             | 32 ++++++++++++++++++++++----------
 7 files changed, 85 insertions(+), 12 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 9cb229f..b124e7e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,9 @@ nagios-plugins (1.4.3.0cvs.20060707-4) UNRELEASED; urgency=low
   * 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
 
diff --git a/debian/control b/debian/control
index 23f09ee..a7c15c3 100644
--- a/debian/control
+++ b/debian/control
@@ -30,7 +30,7 @@ Description: Plugins for the nagios network monitoring and management system
 
 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 @@ Package: nagios-plugins-standard
 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
diff --git a/debian/nagios-plugins-basic.postinst b/debian/nagios-plugins-basic.postinst
new file mode 100644
index 0000000..55b883a
--- /dev/null
+++ b/debian/nagios-plugins-basic.postinst
@@ -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#
diff --git a/debian/nagios-plugins-basic.postrm.in b/debian/nagios-plugins-basic.postrm.in
new file mode 100644
index 0000000..6df65a0
--- /dev/null
+++ b/debian/nagios-plugins-basic.postrm.in
@@ -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#
diff --git a/debian/nagios-plugins-standard.postinst b/debian/nagios-plugins-standard.postinst
new file mode 100644
index 0000000..1d8eb75
--- /dev/null
+++ b/debian/nagios-plugins-standard.postinst
@@ -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#
diff --git a/debian/nagios-plugins-standard.postrm.in b/debian/nagios-plugins-standard.postrm.in
new file mode 100644
index 0000000..2b9cbf1
--- /dev/null
+++ b/debian/nagios-plugins-standard.postrm.in
@@ -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#
diff --git a/debian/rules b/debian/rules
index 33c7193..3568717 100755
--- a/debian/rules
+++ b/debian/rules
@@ -18,17 +18,21 @@ DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 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: patch-stamp build-stamp
 
 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 @@ really-clean:
 	-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 @@ install: build
 	# 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.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nagios-plugins.git



More information about the Pkg-nagios-changes mailing list