[pkg-bacula-commits] [bacula] 05/05: correctly handle the script delete_catalog_backup in bacula-director, change postinst/postrm files accordingly (Closes: #834034)

Carsten Leonhardt leo at moszumanska.debian.org
Sun Aug 28 22:15:29 UTC 2016


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

leo pushed a commit to branch migrate-files
in repository bacula.

commit 0127e3cac1d891060d1bd6ae72e57f3f6817ade3
Author: Carsten Leonhardt <leo at debian.org>
Date:   Mon Aug 29 00:14:07 2016 +0200

    correctly handle the script delete_catalog_backup in bacula-director,
    change postinst/postrm files accordingly (Closes: #834034)
---
 debian/bacula-director-db.postinst.in | 15 --------
 debian/bacula-director-db.postrm.in   |  3 +-
 debian/bacula-director.postinst       | 69 +++++++++++++++++++++++++++++++++++
 debian/bacula-director.postrm         | 16 ++++++++
 debian/changelog                      |  5 +++
 5 files changed, 91 insertions(+), 17 deletions(-)

diff --git a/debian/bacula-director-db.postinst.in b/debian/bacula-director-db.postinst.in
index 6906249..6f309f6 100644
--- a/debian/bacula-director-db.postinst.in
+++ b/debian/bacula-director-db.postinst.in
@@ -100,21 +100,6 @@ configure)
 		esac
         fi
 
-	case "$THISDB" in
-		mysql | pgsql)
-			DBNAME="$dbc_dbname"
-		;;
-		sqlite3)
-			DBNAME="$BACULADBNAME"
-		;;
-	esac
-	SUBST_VARIABLES=DBNAME
-	install_config \
-	    bacula-director-$THISDB \
-	    /usr/share/bacula-common/defconfig/scripts/delete_catalog_backup \
-	    /etc/bacula/scripts/delete_catalog_backup
-	chmod 755 /etc/bacula/scripts/delete_catalog_backup
-
 	# the remainder was formerly the content of postinst-common:
 	DEFCONFIGDIR="/usr/share/bacula-common/defconfig"
 	DSTDIR="/etc/bacula"
diff --git a/debian/bacula-director-db.postrm.in b/debian/bacula-director-db.postrm.in
index f1ad40a..5d7c8bf 100644
--- a/debian/bacula-director-db.postrm.in
+++ b/debian/bacula-director-db.postrm.in
@@ -20,8 +20,7 @@ fi
 
 case "$1" in
   purge)
-    UCF_CONFIG_FILES="/etc/default/bacula-dir \
-      /etc/bacula/scripts/delete_catalog_backup"
+    UCF_CONFIG_FILES="/etc/default/bacula-dir"
 
 		# purge configs if there are no installed package
 		# for other database type
diff --git a/debian/bacula-director.postinst b/debian/bacula-director.postinst
new file mode 100644
index 0000000..4622c0b
--- /dev/null
+++ b/debian/bacula-director.postinst
@@ -0,0 +1,69 @@
+#!/bin/sh
+# postinst script for bacula-director
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see https://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+case "$1" in
+    configure)
+	if [ -r /usr/share/bacula-common/dbc_database.conf ] ; then
+	    . /usr/share/bacula-common/dbc_database.conf
+	fi
+	# take over ownership of delete_catalog_backup
+	# (also if previous version is empty)
+	if dpkg --compare-versions "$3" lt "7.4.3+dfsg-4"; then
+	    ucfr -v -f bacula-director /etc/bacula/scripts/delete_catalog_backup
+        fi
+
+	# execute only if dbconfig is in use
+        if [ "$dbc_install" = "true" ] ; then
+	    # the configure step essentially just replaces XXX_DBNAME_XXX
+	    # with the real database name in
+	    # /etc/bacula/scripts/delete_catalog_backup
+	    . /usr/share/bacula-common/common-functions.dpkg
+
+	    case "$dbc_dbtype" in
+		mysql | pgsql)
+		    DBNAME="$dbc_dbname"
+		    ;;
+		sqlite3)
+		    DBNAME=`echo "$dbc_dbname" | sed 's/.db$//'`
+		    ;;
+	    esac
+	    SUBST_VARIABLES=DBNAME
+	    install_config \
+		bacula-director \
+		/usr/share/bacula-common/defconfig/scripts/delete_catalog_backup \
+		/etc/bacula/scripts/delete_catalog_backup
+	    chmod 755 /etc/bacula/scripts/delete_catalog_backup
+	fi
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/bacula-director.postrm b/debian/bacula-director.postrm
index 29a2f4d..d710337 100644
--- a/debian/bacula-director.postrm
+++ b/debian/bacula-director.postrm
@@ -23,6 +23,22 @@ CONFFILE=/etc/bacula/bacula-dir.conf
 case "$1" in
 	purge)
 		rm -f $CONFFILE $CONFFILE.dist
+
+		# purge all conffiles of this package that are
+		# registered through ucf (this cannot be put into
+		# common-functions.dpkg as it might be unavailable
+		# during purge)
+		PACKAGE=bacula-director
+		if [ -x `which ucfq` ]; then
+		    for conffile in $(ucfq -w $PACKAGE | cut -d: -f1); do
+			rm -f $conffile
+			for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist; do
+			    rm -f $conffile$ext
+			done
+			ucf --purge $conffile
+			ucfr --purge $PACKAGE $conffile
+		    done
+		fi
 	;;
 
 	remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
diff --git a/debian/changelog b/debian/changelog
index 4c4c6ac..8081712 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,11 @@ bacula (7.4.3+dfsg-4) experimental; urgency=medium
     upgrades or when /etc/defaults/bacula-* were edited
     (merged from 7.4.3+dfsg-1+sid1)
 
+  Continue reorganisation of packages:
+
+  * change postinst/postrm files to correctly handle the script
+    delete_catalog_backup in bacula-director (Closes: #834034)
+
  --
 
 bacula (7.4.3+dfsg-3) experimental; urgency=medium

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



More information about the pkg-bacula-commits mailing list