[Pkg-nagios-changes] [pkg-nagvis] 01/04: Fixed handling of config file migration, old configs and purge

Markus Frosch lazyfrosch-guest at moszumanska.debian.org
Thu Dec 12 22:09:45 UTC 2013


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

lazyfrosch-guest pushed a commit to branch master
in repository pkg-nagvis.

commit 0c87a9f3bdd7953f0c54a994a692b47e8bc1b2f8
Author: Markus Frosch <markus at lazyfrosch.de>
Date:   Thu Dec 12 21:26:30 2013 +0100

    Fixed handling of config file migration, old configs and purge
---
 debian/nagvis.postinst | 24 ++++++++++++++++++++----
 debian/nagvis.postrm   | 14 ++++++++++----
 debian/nagvis.preinst  |  6 +++++-
 3 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/debian/nagvis.postinst b/debian/nagvis.postinst
index dc0ba78..7b95597 100644
--- a/debian/nagvis.postinst
+++ b/debian/nagvis.postinst
@@ -17,6 +17,26 @@ set -e
 # for details, see http://www.debian.org/doc/debian-policy/ or
 # the debian-policy package
 
+if dpkg --compare-versions "$2" lt-nl "1:1.7.9+dfsg1-1~"; then
+    # help by adding a empty file
+    touch /etc/nagvis/apache2.conf
+
+    # move /etc/apache2/conf.d/nagvis.conf to /etc/nagvis/apache2.conf
+    dpkg-maintscript-helper mv_conffile \
+        /etc/apache2/conf.d/nagvis.conf /etc/nagvis/apache2.conf "1:1.7.9+dfsg1-1~" nagvis -- "$@"
+
+    # unregister old file
+    ucfr -p nagvis /etc/apache2/conf.d/nagvis.conf
+    # delete helper file
+    rm -f /etc/nagvis/apache2.conf.dpkg-new
+
+    # remove old automap
+    dpkg-maintscript-helper rm_conffile \
+        /etc/nagvis/automaps/__automap.cfg "1:1.7.9+dfsg1-1~" nagvis -- "$@"
+
+    rmdir /etc/nagvis/automaps/ 2>/dev/null || true
+fi
+
 case "$1" in
     configure)
         # Source debconf library.
@@ -131,10 +151,6 @@ case "$1" in
     ;;
 esac
 
-# move /etc/apache2/conf.d/nagvis.conf to /etc/nagvis/apache2.conf
-dpkg-maintscript-helper mv_conffile \
-    /etc/apache2/conf.d/nagvis.conf /etc/nagvis/apache2.conf "1:1.6.6+dfsg.1-3" nagvis -- "$@"
-
 # dh_installdeb will replace this with shell code automatically
 # generated by other debhelper scripts.
 
diff --git a/debian/nagvis.postrm b/debian/nagvis.postrm
index ad77b28..fb9ef9b 100644
--- a/debian/nagvis.postrm
+++ b/debian/nagvis.postrm
@@ -20,7 +20,11 @@ set -e
 
 # move /etc/apache2/conf.d/nagvis.conf to /etc/nagvis/apache2.conf
 dpkg-maintscript-helper mv_conffile \
-    /etc/apache2/conf.d/nagvis.conf /etc/nagvis/apache2.conf "1:1.6.6+dfsg.1-3" nagvis -- "$@"
+    /etc/apache2/conf.d/nagvis.conf /etc/nagvis/apache2.conf "1:1.7.9+dfsg1-1~" nagvis -- "$@"
+
+# remove old automap
+dpkg-maintscript-helper rm_conffile \
+    /etc/nagvis/automaps/__automap.cfg "1:1.7.9+dfsg1-1~" nagvis -- "$@"
 
 # Apache2
 if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
@@ -38,7 +42,7 @@ case "$1" in
     purge)
         ## remove apache part of the configuration and nagvis' ini file
         ## (both generetaded in postinst)
-        for conf_file in /etc/apache2/conf.d/nagvis.conf /etc/nagvis/nagvis.ini.php ; do
+        for conf_file in /etc/nagvis/apache2.conf /etc/nagvis/nagvis.ini.php ; do
             rm -f "$conf_file"
             if which ucf >/dev/null; then
                 ucf --purge "$conf_file"
@@ -57,8 +61,10 @@ case "$1" in
             delete_on_purge="$RET"
         fi
         if [ "$delete_on_purge" = "true" ]; then
-	    rm -f /etc/nagvis/auth.db
-            rm -rf /etc/nagvis/magps/*
+            rm -f /etc/nagvis/auth.db
+            rm -rf /etc/nagvis/automaps/*
+            rm -rf /etc/nagvis/maps/*
+            rm -rf /etc/nagvis/profiles/*
             rm -rf /var/cache/nagvis/*
         fi
     ;;
diff --git a/debian/nagvis.preinst b/debian/nagvis.preinst
index 22c0bfd..954fcf2 100644
--- a/debian/nagvis.preinst
+++ b/debian/nagvis.preinst
@@ -15,7 +15,11 @@ set -e
 
 # move /etc/apache2/conf.d/nagvis.conf to /etc/nagvis/apache2.conf
 dpkg-maintscript-helper mv_conffile \
-    /etc/apache2/conf.d/nagvis.conf /etc/nagvis/apache2.conf "1:1.6.6+dfsg.1-3" nagvis -- "$@"
+    /etc/apache2/conf.d/nagvis.conf /etc/nagvis/apache2.conf "1:1.7.9+dfsg1-1~" nagvis -- "$@"
+
+# remove old automap
+dpkg-maintscript-helper rm_conffile \
+    /etc/nagvis/automaps/__automap.cfg "1:1.7.9+dfsg1-1~" nagvis -- "$@"
 
 case "$1" in
     install|upgrade)

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



More information about the Pkg-nagios-changes mailing list