[Pkg-nagios-changes] [pkg-nagios-plugins] 48/413: a little more work for sarge transitioning

Jan Wagner waja at moszumanska.debian.org
Tue Nov 26 23:13:05 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 f0bf0b77ebc624220cdf7dc449efda6b8e9ab6ad
Author: Sean Finney <seanius at debian.org>
Date:   Wed Dec 6 17:35:02 2006 +0000

    a little more work for sarge transitioning
---
 debian/functions | 43 ++++++++++++++++++++++++-------------------
 debian/rules     | 21 +++++++++++----------
 2 files changed, 35 insertions(+), 29 deletions(-)

diff --git a/debian/functions b/debian/functions
index 176fdf2..df2ca59 100644
--- a/debian/functions
+++ b/debian/functions
@@ -1,26 +1,31 @@
 # functions for use by nagios plugins maintainer scripts
 
-# called as "register_cfgs $2" from postinst
+npconfdir=/etc/nagios-plugins/config
+npdpkgdir=/usr/share/nagios-plugins/dpkg
+
+# determine whether the file is the default file shipped in sarge
+# (called as is_pristine_sarge_file foo.cfg)
+is_pristine_sarge_file(){
+	sargemd5=`grep "${npconfdir}/$1" ${npdpkgdir}/sarge.md5sums | cut -d' ' -f1`
+	curmd5=`md5sum "${npconfdir}/$1" | cut -d' ' -f1`
+	if [ "$curmd5" = "$sargemd5" ]; then return 0; else return 1; fi
+}
+
+# we now register all n-p config files via ucf.  this means
+# we have to do a little bit of hand-holding for sarge migrations...
+# (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
+		( 
+			cd $templdir
+			for f in *cfg; do
+				dest=${npconfdir}/$f
+				if is_pristine_sarge_file $f; then
+					cp $f $dest
+				fi
+				ucf $f $dest
+			done 
+		);
 	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/rules b/debian/rules
index b35155a..0af910d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,10 +17,11 @@ DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
 CFLAGS = -Wall -g
 
+DEBIANDIR=$(CURDIR)/debian
 NP_LIBEXEC:=/usr/lib/nagios/plugins
-NP_BASIC_DIR:=$(CURDIR)/debian/nagios-plugins-basic
+NP_BASIC_DIR:=$(DEBIANDIR)/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_DIR:=$(DEBIANDIR)/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 \
@@ -118,7 +119,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
+	-rm -f $(DEBIANDIR)/nagios-plugins-basic.postrm $(DEBIANDIR)/nagios-plugins-standard.postrm
 	dh_clean 
 
 install: build
@@ -137,21 +138,21 @@ install: build
 	# 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}; \
+		cp $(DEBIANDIR)/pluginconfig/$${c}.cfg ${NP_BASIC_TEMPLATES}; \
 	done
 	for c in ${std_plugin_cfgs}; do \
-		cp $(CURDIR)/debian/pluginconfig/$${c}.cfg ${NP_STD_TEMPLATES}; \
+		cp $(DEBIANDIR)/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
+		< $(DEBIANDIR)/nagios-plugins-basic.postrm.in \
+		> $(DEBIANDIR)/nagios-plugins-basic.postrm
 	sed -e 's/@STD_PLUGINS@/${std_plugin_cfgs}/' \
-		< debian/nagios-plugins-standard.postrm.in \
-		> debian/nagios-plugins-standard.postrm
+		< $(DEBIANDIR)/nagios-plugins-standard.postrm.in \
+		> $(DEBIANDIR)/nagios-plugins-standard.postrm
 	# copy our dpkg-sourced functions into place
-	install -m 644 -D $(CURDIR)/debian/functions \
+	install -m 644 -D $(DEBIANDIR)/functions $(DEBIANDIR)/sarge.md5sums \
 		${NP_BASIC_DIR}/usr/share/nagios-plugins/dpkg/functions
 
 

-- 
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