[Pkg-nagios-changes] [pkg-nagios] r1192 - ndoutils/trunk/debian

Hendrik Frenzel hfrenzel-guest at alioth.debian.org
Mon Jul 9 20:39:17 UTC 2007


Author: hfrenzel-guest
Date: 2007-07-09 20:39:17 +0000 (Mon, 09 Jul 2007)
New Revision: 1192

Modified:
   ndoutils/trunk/debian/changelog
   ndoutils/trunk/debian/control
   ndoutils/trunk/debian/ndoutils-DB.config.in
   ndoutils/trunk/debian/ndoutils-DB.ndoutils.default.in
   ndoutils/trunk/debian/ndoutils-DB.ndoutils.init.in
   ndoutils/trunk/debian/ndoutils-DB.postinst.in
   ndoutils/trunk/debian/ndoutils-DB.postrm.in
   ndoutils/trunk/debian/ndoutils-DB.prerm.in
   ndoutils/trunk/debian/rules
Log:
cosmetic fixes



Modified: ndoutils/trunk/debian/changelog
===================================================================
--- ndoutils/trunk/debian/changelog	2007-07-09 13:20:09 UTC (rev 1191)
+++ ndoutils/trunk/debian/changelog	2007-07-09 20:39:17 UTC (rev 1192)
@@ -1,3 +1,16 @@
+ndoutils (1.4b4-2) unstable; urgency=low
+
+  * Fixed comments in debian/rules
+  * Changed Build-Depend to libmysqlclient15-dev too
+  * Used dbc_generate_include to generate ndo2db.cfg
+  * Removed configuration of broker_module in nagios.cfg (See README.Debian)
+  * Removed invoke-rc.d/nagios2 in {pre,post}{inst,rm}
+  * Fixed some lintian warnings
+  * Moved ndoutils specific binaries to /usr/lib/ndoutils 
+  * Created manpages for binaries
+
+ -- Hendrik Frenzel <hfrenzel at scunc.net>  Mon, 09 Jul 2007 22:13:48 +0200
+
 ndoutils (1.4b4-1) unstable; urgency=low
 
   * New upstream release.

Modified: ndoutils/trunk/debian/control
===================================================================
--- ndoutils/trunk/debian/control	2007-07-09 13:20:09 UTC (rev 1191)
+++ ndoutils/trunk/debian/control	2007-07-09 20:39:17 UTC (rev 1192)
@@ -2,7 +2,7 @@
 Section: net
 Priority: extra
 Maintainer: Hendrik Frenzel <hfrenzel at scunc.net>
-Build-Depends: debhelper (>= 5), dpatch, autotools-dev, libmysqlclient-dev
+Build-Depends: debhelper (>= 5), dpatch, autotools-dev, libmysqlclient15-dev | libmysqlclient-dev
 Standards-Version: 3.7.2
 
 Package: ndoutils-mysql
@@ -12,20 +12,22 @@
 Pre-Depends: nagios2
 Depends: mysql-client, ucf, debconf, dbconfig-common, ${shlibs:Depends}, ${misc:Depends}
 Recommends: mysql-server
-Suggests: ndoutols-doc
-Description: This provides the NDOUtis for Nagios with MySQL support
- The NDOUTILS (Nagios Data Output Utils) addon allows you to move status
+Suggests: ndoutils-doc
+Description: This provides the NDOUtils for Nagios with MySQL support
+ The NDOUtils (Nagios Data Output Utils) addon allows you to move status
  and event information from Nagios to a database for later retrieval and
  processing.
  .
  This package uses MySQL databases.
+ .
+  Homepage: http://www.nagios.org
 
 Package: ndoutils-doc
 Section: doc
 Architecture: all
 Suggests: ndoutils
 Description: Documentation for ndoutils
- The NDOUTILS (Nagios Data Output Utils) addon allows you to move status
+ The NDOUtils (Nagios Data Output Utils) addon allows you to move status
  and event information from Nagios to a database for later retrieval and
  processing.
  .

Modified: ndoutils/trunk/debian/ndoutils-DB.config.in
===================================================================
--- ndoutils/trunk/debian/ndoutils-DB.config.in	2007-07-09 13:20:09 UTC (rev 1191)
+++ ndoutils/trunk/debian/ndoutils-DB.config.in	2007-07-09 20:39:17 UTC (rev 1192)
@@ -9,4 +9,5 @@
 	. /usr/share/dbconfig-common/dpkg/config.@@DB@@
 	dbc_go @@PACKAGE@@ $@
 fi
+db_stop
 

Modified: ndoutils/trunk/debian/ndoutils-DB.ndoutils.default.in
===================================================================
--- ndoutils/trunk/debian/ndoutils-DB.ndoutils.default.in	2007-07-09 13:20:09 UTC (rev 1191)
+++ ndoutils/trunk/debian/ndoutils-DB.ndoutils.default.in	2007-07-09 20:39:17 UTC (rev 1192)
@@ -6,5 +6,9 @@
 # This is a POSIX shell fragment
 #
 
+# You have to enable ndoutils broker module first to use ndoutils.
+# (see /usr/share/doc/@@PACKAGE@@/README.Debian)
+ENABLE_NDOUTILS=0
+
 # Additional options that are passed to the Daemon.
 DAEMON_OPTS="-c /etc/nagios2/ndo2db.cfg"

Modified: ndoutils/trunk/debian/ndoutils-DB.ndoutils.init.in
===================================================================
--- ndoutils/trunk/debian/ndoutils-DB.ndoutils.init.in	2007-07-09 13:20:09 UTC (rev 1191)
+++ ndoutils/trunk/debian/ndoutils-DB.ndoutils.init.in	2007-07-09 20:39:17 UTC (rev 1192)
@@ -39,12 +39,13 @@
 case "$1" in
   start)
 	echo -n "Starting $DESC: "
+	test ! "$ENABLE_NDOUTILS" = 1 && { echo "Not enabled in /etc/defaults/ndoutils."; exit 0; }
 	start-stop-daemon --start --quiet --user nagios --group nagios --exec $DAEMON --background -- $DAEMON_OPTS
 	echo "$NAME."
 	;;
   stop)
 	echo -n "Stopping $DESC: "
-	start-stop-daemon --stop --quiet --exec $DAEMON 
+	start-stop-daemon --stop --oknodo --quiet --exec $DAEMON 
 	echo "$NAME."
 	;;
   #reload)
@@ -73,6 +74,7 @@
     echo -n "Restarting $DESC: "
 	start-stop-daemon --stop --quiet --user nagios --group nagios --exec $DAEMON 
 	sleep 1
+	test ! "$ENABLE_NDOUTILS" = 1 && { echo "Not enabled in /etc/defaults/ndoutils."; exit 0; }
 	start-stop-daemon --start --quiet --exec $DAEMON --background -- $DAEMON_OPTS
 	echo "$NAME."
 	;;

Modified: ndoutils/trunk/debian/ndoutils-DB.postinst.in
===================================================================
--- ndoutils/trunk/debian/ndoutils-DB.postinst.in	2007-07-09 13:20:09 UTC (rev 1191)
+++ ndoutils/trunk/debian/ndoutils-DB.postinst.in	2007-07-09 20:39:17 UTC (rev 1192)
@@ -5,13 +5,15 @@
 
 set -e
 
-dbc_remember_app_pass="true"
-
 . /usr/share/debconf/confmodule
 if [ -f /usr/share/dbconfig-common/dpkg/postinst.@@DB@@ ]; then
 	. /usr/share/dbconfig-common/dpkg/postinst.@@DB@@
+	dbc_generate_include='template:/etc/nagios2/ndo2db.cfg'
+	dbc_generate_include_owner='nagios:nagios'
+	dbc_generate_include_args='--ucf -o template_infile=/usr/share/@@PACKAGE@@/tmpl/ndo2db.cfg '
 	dbc_go @@PACKAGE@@ $@
 fi
+db_stop
 
 # summary of how this script can be called:
 #        * <postinst> `configure' <most-recently-configured-version>
@@ -25,54 +27,9 @@
 # for details, see http://www.debian.org/doc/debian-policy/ or
 # the debian-policy package
 
-if which ucf > /dev/null 2>&1; then
-	have_ucf="yes"
-fi
-
 case "$1" in
     configure)
-	db_get @@PACKAGE@@/remote/host && host="$RET"
-	db_get @@PACKAGE@@/remote/port && port="$RET"
-	db_get @@PACKAGE@@/db/dbname && db_name="$RET"
-	db_get @@PACKAGE@@/@@DB@@/app-pass && app_pass="$RET"
-	db_get @@PACKAGE@@/db/app-user && app_user="$RET"
-	dbc_forget_app_password @@PACKAGE@@ $@
-	
-	if [ -z "$host" ]; then host=localhost; fi
-	if [ -z "$port" ]; then port=@@DBPORT@@; fi
-
-    	cd /usr/share/@@PACKAGE@@/tmpl
-	tmp=`mktemp`
-	sed -e "s/^ *[^#]* *\(\<db_servertype\) *=.*\$/\1=@@DB@@/;
-		s/^ *[^#]* *\(\<db_host\) *=.*\$/\1=$host/;
-		s/^ *[^#]* *\(\<db_port\) *=.*\$/\1=$port/;
-		s/^ *[^#]* *\(\<db_name\) *=.*\$/\1=$db_name/;
-		s/^ *[^#]* *\(\<db_user\) *=.*\$/\1=$app_user/;
-		s/^ *[^#]* *\(\<db_pass\) *=.*\$/\1=$app_pass/" \
-		< ndo2db.cfg > $tmp
-	
-	if [ "$have_ucf" = 'yes' ]; then
-		ucf $tmp /etc/nagios2/ndo2db.cfg
-		ucf ndomod.cfg /etc/nagios2/ndomod.cfg
-	else
-		cp -a -f $tmp /etc/nagios2/ndo2db.cfg
-		cp -a -f ndomod.cfg /etc/nagios2/ndomod.cfg
-	fi
-
-	rm -f $tmp
-	
-	# change nagios.cfg
-	broker_module='/usr/lib/ndoutils/ndomod.o config_file=/etc/nagios2/ndomod.cfg'
-	if ! `grep -e '^\s*[^#]*\s*\<broker_module\s*=' /etc/nagios2/nagios.cfg 2>&1 >/dev/null`; then
-		echo "broker_module=${broker_module}" >> /etc/nagios2/nagios.cfg
-	fi
-	tmp=`mktemp`
-	sed -e "s@^ *[^#]* *\(\<broker_module\) *=.*\$@\1=${broker_module}@" < /etc/nagios2/nagios.cfg > $tmp
-	ucf $tmp /etc/nagios2/nagios.cfg
-	rm -f $tmp
-
-	# (re)start nagios2
-	invoke-rc.d nagios2 restart 
+    	ucf /usr/share/@@PACKAGE@@/tmpl/ndomod.cfg /etc/nagios2/ndomod.cfg
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)

Modified: ndoutils/trunk/debian/ndoutils-DB.postrm.in
===================================================================
--- ndoutils/trunk/debian/ndoutils-DB.postrm.in	2007-07-09 13:20:09 UTC (rev 1191)
+++ ndoutils/trunk/debian/ndoutils-DB.postrm.in	2007-07-09 20:39:17 UTC (rev 1192)
@@ -14,6 +14,13 @@
 	dbc_go @@PACKAGE@@ $@
 fi
 
+if [ "$1" = "purge" ]; then
+	for f in ndomod.cfg ndo2db.cfg; do
+		rm -f /etc/nagios2/$f
+		ucf --purge /etc/nagios2/$f
+	done
+fi
+
 # summary of how this script can be called:
 #        * <postrm> `remove'
 #        * <postrm> `purge'
@@ -26,13 +33,9 @@
 #          <overwriter-version>
 # for details, see http://www.debian.org/doc/debian-policy/ or
 # the debian-policy package
-if which ucf > /dev/null 2>&1; then
-	have_ucf="yes"
-fi
 
 case "$1" in
     purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-	invoke-rc.d nagios2 restart
     ;;
 
     *)
@@ -41,14 +44,6 @@
     ;;
 esac
 
-if [ "$1" -eq 'purge' ]; then
-	for f in ndomod.cfg ndo2db.cfg; do
-		rm -f /etc/nagios2/$f
-		if [ "$have_ucf" = "yes" ]; then
-			ucf --purge /etc/nagios2/$f
-		fi
-	done
-fi
 	
 
 # dh_installdeb will replace this with shell code automatically

Modified: ndoutils/trunk/debian/ndoutils-DB.prerm.in
===================================================================
--- ndoutils/trunk/debian/ndoutils-DB.prerm.in	2007-07-09 13:20:09 UTC (rev 1191)
+++ ndoutils/trunk/debian/ndoutils-DB.prerm.in	2007-07-09 20:39:17 UTC (rev 1192)
@@ -23,7 +23,6 @@
 
 case "$1" in
     remove|upgrade|deconfigure)
-    	invoke-rc.d nagios2 stop
     ;;
 
     failed-upgrade)

Modified: ndoutils/trunk/debian/rules
===================================================================
--- ndoutils/trunk/debian/rules	2007-07-09 13:20:09 UTC (rev 1191)
+++ ndoutils/trunk/debian/rules	2007-07-09 20:39:17 UTC (rev 1192)
@@ -43,13 +43,13 @@
 CONFIG_MYSQL = CPPFLAGS=`mysql_config --include` $(CONFIGURE) \
 	--enable-mysql --disable-pgsql
 #CONFIG_PGSQL = CPPFLAGS="-I`pg_config --includedir`" $(CONFIGURE) \
-	--enable-pgsql --disable-mysql --with-pgsql-lib=`pg_config --libdir` --with-pgsql-inc=`pg_config --includedir`
+#	--enable-pgsql --disable-mysql --with-pgsql-lib=`pg_config --libdir` --with-pgsql-inc=`pg_config --includedir`
 
 clean: unpatch
 	dh_testdir -a
 	dh_testroot -a
 	-rm -f {build,config}-ndoutils-{mysql,pgsql}-stamp
-	-$(MAKE) distclean
+	[ ! -f Makefile ] || $(MAKE) distclean
 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
 	cp -f /usr/share/misc/config.sub config.sub
 endif
@@ -59,15 +59,13 @@
 	rm -f src/*-{mysql,pgsql}-{2,3}x*
 	rm -f src/*-{mysql,pgsql}
 	rm -f {install,configure,build}-stamp
-	#rm -f debian/*.7.gz # TODO: manpages!
-	rm -f debian/ndoutils-{my,pg}sql.{dirs,ndoutils.{default,init},config,{pre,post}{inst,rm}}
+	rm -f debian/ndoutils-{my,pg}sql.{dirs,manpages,ndoutils.{default,init},config,{pre,post}{inst,rm}}
 	dh_clean
 
 config-ndoutils-mysql: config-ndoutils-mysql-stamp
 config-ndoutils-mysql-stamp: patch
 	dh_testdir -a
 	@echo " ### Doing $@"
-	-make clean;
 	$(CONFIG_MYSQL)
 	touch $@
 
@@ -116,37 +114,55 @@
 
 ndoutils-mysql: build-ndoutils-mysql
 	@echo " ### Doing $@"
-	for script in dirs ndoutils.{default,init} config {pre,post}{rm,inst}; do \
-		sed "s/@@DB@@/mysql/g;s/@@PACKAGE@@/$@/g;s/@@DBPORT@@/3306/g" \
-			< debian/ndoutils-DB.$${script}.in  > debian/$@.$${script}; \
+	for script in dirs ndoutils.{default,init} config {pre,post}{rm,inst} manpages; do \
+		test -e debian/ndoutils-DB.$${script}.in && \
+			sed "s/@@DB@@/mysql/g;s/@@PACKAGE@@/$@/g;s/@@DBPORT@@/3306/g" \
+				< debian/ndoutils-DB.$${script}.in > debian/$@.$${script}; \
 	done
 	dh_installdirs -p$@ -P$(b)/$@
 	# install the binaries
 	install -m 755 src/ndomod-mysql-2x.o debian/$@/usr/lib/ndoutils/ndomod.o
-	install -m 755 src/ndo2db-mysql-2x   debian/$@/usr/sbin/ndo2db
-	install -m 755 src/sockdebug-mysql   debian/$@/usr/sbin/sockdebug
-	install -m 755 src/file2sock-mysql   debian/$@/usr/sbin/file2sock
-	install -m 755 src/log2ndo-mysql     debian/$@/usr/sbin/log2ndo
+	install -m 755 src/ndo2db-mysql-2x   debian/$@/usr/lib/ndoutils/ndo2db
+	install -m 755 src/sockdebug-mysql   debian/$@/usr/lib/ndoutils/sockdebug
+	install -m 755 src/file2sock-mysql   debian/$@/usr/lib/ndoutils/file2sock
+	install -m 755 src/log2ndo-mysql     debian/$@/usr/lib/ndoutils/log2ndo
 	# install the config templates
 	install -m 644 config/ndomod.cfg debian/$@/usr/share/$@/tmpl/
 	install -m 644 config/ndo2db.cfg debian/$@/usr/share/$@/tmpl/
+	sed -e 's/^ *[^#]* *\(\<db_servertype\) *=.*$$/\1=_DBC_DBTYPE_/' \
+	    -e 's/^ *[^#]* *\(\<db_host\) *=.*$$/\1=_DBC_DBSERVER_/' \
+	    -e 's/^ *[^#]* *\(\<db_port\) *=.*$$/\1=_DBC_DBPORT_/' \
+	    -e 's/^ *[^#]* *\(\<db_name\) *=.*$$/\1=_DBC_DBNAME_/' \
+	    -e 's/^ *[^#]* *\(\<db_user\) *=.*$$/\1=_DBC_DBUSER_/' \
+	    -e 's/^ *[^#]* *\(\<db_pass\) *=.*$$/\1=_DBC_DBPASS_/' \
+		< debian/$@/usr/share/$@/tmpl/ndo2db.cfg \
+		> debian/$@/usr/share/$@/tmpl/ndo2db.cfg.sed && \
+		mv debian/$@/usr/share/$@/tmpl/ndo2db.cfg.sed \
+			debian/$@/usr/share/$@/tmpl/ndo2db.cfg
+	
+	mkdir -p debian/$@/usr/share/$@/tmpl/configs
+	
 	# install the SQL schemes
-	install -m 644 db/mysql.sql               debian/$@/usr/share/dbconfig-common/data/$@/install/mysql
-	install -m 644 db/mysql-upgrade-1.3.sql   debian/$@/usr/share/dbconfig-common/data/$@/upgrade/mysql/1.3
-	install -m 644 db/mysql-upgrade-1.4b1.sql debian/$@/usr/share/dbconfig-common/data/$@/upgrade/mysql/1.4b1
-	install -m 644 db/mysql-upgrade-1.4b2.sql debian/$@/usr/share/dbconfig-common/data/$@/upgrade/mysql/1.4b2
+	install -m 644 db/mysql.sql \
+		debian/$@/usr/share/dbconfig-common/data/$@/install/mysql
+	install -m 644 db/mysql-upgrade-1.3.sql \
+		debian/$@/usr/share/dbconfig-common/data/$@/upgrade/mysql/1.3
+	install -m 644 db/mysql-upgrade-1.4b1.sql \
+		debian/$@/usr/share/dbconfig-common/data/$@/upgrade/mysql/1.4b1
+	install -m 644 db/mysql-upgrade-1.4b2.sql \
+		debian/$@/usr/share/dbconfig-common/data/$@/upgrade/mysql/1.4b2
 	
-	# TODO: manpages!
-	#for binary in log2ndo ndo2db ndomod sockdebug file2sock; do \
-	#	ln -s /usr/share/man/man7/undocumented.7.gz debian/$${binary}.7.gz; \
-	#done
-	
 	# use debhelper
 	dh_installchangelogs -p$@ -P$(b)/$@
 	dh_installdebconf -p$@ -P$(b)/$@
 	dh_installdocs  -p$@ -P$(b)/$@
 	dh_installinit  -p$@ -P$(b)/$@ --name=ndoutils
-	#dh_installman   -p$@ -P$(b)/$@ # TODO: manpages!
+	dh_installman   -p$@ -P$(b)/$@
+	dh_link         -p$@ -P$(b)/$@ \
+		usr/lib/ndoutils/ndo2db    usr/sbin/ndo2db \
+		usr/lib/ndoutils/sockdebug usr/sbin/sockdebug \
+		usr/lib/ndoutils/file2sock usr/sbin/file2sock \
+		usr/lib/ndoutils/log2ndo   usr/sbin/log2ndo
 	dh_strip       -p$@ -P$(b)/$@
 	dh_compress    -p$@ -P$(b)/$@
 	dh_fixperms    -p$@ -P$(b)/$@




More information about the Pkg-nagios-changes mailing list