[Pkg-nagios-changes] [pkg-nagios] r1183 - ndoutils/trunk/debian
Hendrik Frenzel
hfrenzel-guest at alioth.debian.org
Thu Jun 21 15:57:00 UTC 2007
Author: hfrenzel-guest
Date: 2007-06-21 15:57:00 +0000 (Thu, 21 Jun 2007)
New Revision: 1183
Modified:
ndoutils/trunk/debian/ndoutils-DB.postinst.in
ndoutils/trunk/debian/ndoutils-DB.postrm.in
Log:
Fixed: Purging configs only while purging the package.
Modified: ndoutils/trunk/debian/ndoutils-DB.postinst.in
===================================================================
--- ndoutils/trunk/debian/ndoutils-DB.postinst.in 2007-06-20 21:27:51 UTC (rev 1182)
+++ ndoutils/trunk/debian/ndoutils-DB.postinst.in 2007-06-21 15:57:00 UTC (rev 1183)
@@ -25,6 +25,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)
@@ -47,15 +50,21 @@
s/^ *[^#]* *\(\<db_user\) *=.*\$/\1=$app_user/;
s/^ *[^#]* *\(\<db_pass\) *=.*\$/\1=$app_pass/" \
< ndo2db.cfg > $tmp
- ucf $tmp /etc/nagios2/ndo2db.cfg
+
+ if [ "$have_ucf" -eq '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
- ucf ndomod.cfg /etc/nagios2/ndomod.cfg
-
# 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
+ 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
@@ -63,7 +72,7 @@
rm -f $tmp
# (re)start nagios2
- #invoke-rc.d nagios2 restart
+ invoke-rc.d nagios2 restart
;;
abort-upgrade|abort-remove|abort-deconfigure)
Modified: ndoutils/trunk/debian/ndoutils-DB.postrm.in
===================================================================
--- ndoutils/trunk/debian/ndoutils-DB.postrm.in 2007-06-20 21:27:51 UTC (rev 1182)
+++ ndoutils/trunk/debian/ndoutils-DB.postrm.in 2007-06-21 15:57:00 UTC (rev 1183)
@@ -26,30 +26,31 @@
# <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)
- if which ucf > /dev/null 2>&1; then
- have_ucf="yes"
- fi
+ invoke-rc.d nagios2 restart
+ ;;
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+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
- invoke-rc.d nagios2 start
- ;;
- *)
- echo "postrm called with unknown argument \`$1'" >&2
- exit 1
- ;;
-esac
-
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
More information about the Pkg-nagios-changes
mailing list