[Pkg-nagios-changes] [pkg-nagios-plugins] 45/413: testing fix for conffile prompts

Jan Wagner waja at moszumanska.debian.org
Tue Nov 26 23:13:04 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 5cc5d666524a41134569d85a5b93fd3364439579
Author: Sean Finney <seanius at debian.org>
Date:   Tue Dec 5 18:34:39 2006 +0000

    testing fix for conffile prompts
---
 debian/changelog                        |  7 +++++++
 debian/control                          |  2 +-
 debian/functions                        | 26 ++++++++++++++++++++++++++
 debian/nagios-plugins-basic.postinst    | 10 ++++------
 debian/nagios-plugins-standard.postinst | 10 ++++------
 debian/rules                            |  3 +++
 6 files changed, 45 insertions(+), 13 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 340e10c..6a907bb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+nagios-plugins (1.4.5-2) UNRELEASED; urgency=low
+
+  * fix for spurious conffile-type prompts from ucf, thanks to
+    Stephen Gran for catching this (closes: #400595).
+
+ -- sean finney <seanius at debian.org>  Tue, 05 Dec 2006 19:29:45 +0100
+
 nagios-plugins (1.4.5-1) unstable; urgency=low
 
   * new upstream (bugfix only) release.  the following patches
diff --git a/debian/control b/debian/control
index 16427ea..dca2af6 100644
--- a/debian/control
+++ b/debian/control
@@ -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, ucf
+Depends: ${shlibs:Depends}, ${misc:Depends}, fping, qstat, snmp, radiusclient1, libnet-snmp-perl, dnsutils, bind9-host | host, smbclient, ucf, nagios-plugins-basic
 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/functions b/debian/functions
new file mode 100644
index 0000000..176fdf2
--- /dev/null
+++ b/debian/functions
@@ -0,0 +1,26 @@
+# functions for use by nagios plugins maintainer scripts
+
+# called as "register_cfgs $2" from postinst
+register_cfgs(){
+	local newinst
+	if [ -z "$1" ]; then
+		newinst="yes"
+		tmpfile=`mktemp -t nagios-plugins.XXXXXX`
+		if [ ! -f "$tmpfile" ]; then 
+			echo "error creating tempfile >&2"
+			exit 1
+		fi
+	fi
+	( 
+		cd $templdir
+		for f in *cfg; do
+			dest=/etc/nagios-plugins/config/$f
+			if [ "$newinst" = "yes" ] && [ -f $dest ]; then
+				cat $dest > $tmpfile
+				ucf $tmpfile $dest
+			fi
+			ucf $f /etc/nagios-plugins/config/$f 
+		done 
+	);
+	if [ "$newinst" = "yes" ]; then rm -f $tmpfile; fi
+}
diff --git a/debian/nagios-plugins-basic.postinst b/debian/nagios-plugins-basic.postinst
index 55b883a..bb212a0 100644
--- a/debian/nagios-plugins-basic.postinst
+++ b/debian/nagios-plugins-basic.postinst
@@ -1,12 +1,10 @@
 #!/bin/sh -e
 
+templdir=/usr/share/nagios-plugins/templates-basic
+. /usr/share/nagios-plugins/dpkg/functions
+
 if [ "$1" = "configure" ]; then
-	( 
-		cd /usr/share/nagios-plugins/templates-basic
-		for f in *cfg; do
-			ucf $f /etc/nagios-plugins/config/$f 
-		done 
-	);
+	register_cfgs $2
 fi
 
 #DEBHELPER#
diff --git a/debian/nagios-plugins-standard.postinst b/debian/nagios-plugins-standard.postinst
index 1d8eb75..6a6b13f 100644
--- a/debian/nagios-plugins-standard.postinst
+++ b/debian/nagios-plugins-standard.postinst
@@ -1,12 +1,10 @@
 #!/bin/sh -e
 
+. /usr/share/nagios-plugins/dpkg/functions
+templdir=/usr/share/nagios-plugins/templates-standard
+
 if [ "$1" = "configure" ]; then
-	( 
-		cd /usr/share/nagios-plugins/templates-standard
-		for f in *cfg; do
-			ucf $f /etc/nagios-plugins/config/$f 
-		done 
-	);
+	register_cfgs $2
 fi
 
 #DEBHELPER#
diff --git a/debian/rules b/debian/rules
index 4c313e0..72bd75b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -150,6 +150,9 @@ install: build
 	sed -e 's/@STD_PLUGINS@/${std_plugin_cfgs}/' \
 		< debian/nagios-plugins-standard.postrm.in \
 		> debian/nagios-plugins-standard.postrm
+	# copy our dpkg-sourced functions into place
+	install -D $(CURDIR)/debian/functions \
+		${NP_BASIC_DIR}/usr/share/nagios-plugins/dpkg/functions
 
 
 # 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