[pkg-bacula-commits] [bacula] 02/02: handle /etc/default/bacula-dir in package bacula-director
Carsten Leonhardt
leo at moszumanska.debian.org
Thu Sep 1 10:40:18 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 34bc37c8a2fdfacc4cc839e4ee5a63f7f6f9cec7
Author: Carsten Leonhardt <leo at debian.org>
Date: Thu Sep 1 12:39:03 2016 +0200
handle /etc/default/bacula-dir in package bacula-director
---
debian/TODO | 6 -----
debian/additions/common-functions.dpkg | 10 ++-------
debian/bacula-director-db.postinst.in | 14 +++---------
debian/bacula-director-db.postrm.in | 40 ----------------------------------
debian/bacula-director.postinst | 13 +++++++++++
debian/bacula-director.postrm | 2 +-
debian/changelog | 9 +++++---
7 files changed, 25 insertions(+), 69 deletions(-)
diff --git a/debian/TODO b/debian/TODO
index aec13e0..05470c4 100644
--- a/debian/TODO
+++ b/debian/TODO
@@ -2,12 +2,6 @@ High:
* debian/*.postinst.in: possibly unsafe handling of file, permissions
should be set before sensible data is written to the file.
- * Rework conffile handling
- - Don't use ucf to handle bacula-*.conf
- https://www.debian.org/doc/debian-policy/ch-files.html#s-config-files
- - Guard calls to ucf / ucfr with checks for existence of ucf / ucfr
- - check that all conffiles are correctly owned by its package
- + /etc/defaults/bacula-dir should be owned/handled by bacula-director
Normal:
diff --git a/debian/additions/common-functions.dpkg b/debian/additions/common-functions.dpkg
index 6cf956e..247dee1 100644
--- a/debian/additions/common-functions.dpkg
+++ b/debian/additions/common-functions.dpkg
@@ -169,13 +169,9 @@ setup_etc_default() {
SERVICE="bacula-sd"
ARGS="-u bacula -g tape"
;;
- bacula-director-pgsql|bacula-director-mysql|bacula-director-sqlite3)
+ bacula-director)
SERVICE="bacula-dir"
ARGS="-u bacula -g bacula"
- if ucfq -w "/etc/default/bacula-dir" \
- |egrep -q '^[^:]*:bacula-director-(pgsql|mysql|sqlite3):'; then
- UCFR_ARGS="-f"
- fi
;;
*)
echo "setup_defaults: unknown package \"$1\"" >&2
@@ -186,8 +182,6 @@ setup_etc_default() {
ENABLED="yes"
CONFIG="/etc/bacula/$SERVICE.conf"
DEFAULTS="/etc/default/$SERVICE"
- UCFR_ARGS="${UCFR_ARGS:-}"
-
if [ -n "$3" ]; then
if dpkg --compare-versions "$3" lt "5.2.6+dfsg-1"; then
@@ -239,7 +233,7 @@ _EOF
esac
ucf --debconf-ok "$tempfile" "$DEFAULTS"
- ucfr $UCFR_ARGS "$PACKAGE" "$DEFAULTS"
+ ucfr "$PACKAGE" "$DEFAULTS"
rm -f "$tempfile"
}
diff --git a/debian/bacula-director-db.postinst.in b/debian/bacula-director-db.postinst.in
index 16c4fba..0a5a187 100644
--- a/debian/bacula-director-db.postinst.in
+++ b/debian/bacula-director-db.postinst.in
@@ -40,13 +40,6 @@ case "$THISDB" in
;;
esac
-# XXX disabled for now, the mechanism might be better used to create
-# an include for bacula-dir.conf?
-# generate a config file containing relevant database information
-#dbc_generate_include=sh:/etc/bacula/dbc_database.conf
-#dbc_generate_include_owner=bacula:bacula
-#dbc_generate_include_perms=0640
-
if test "$1" = "configure" -a -n "$2"; then
invoke-rc.d bacula-director stop || true
fi
@@ -64,12 +57,11 @@ fi
DEFCONFIG="/usr/share/bacula-common/defconfig"
CFGFILE="/etc/bacula/bacula-dir.conf"
-. /usr/share/bacula-common/common-functions.dpkg
-readOrCreatePasswords
-setup_etc_default bacula-director-$THISDB $@
-
case "$1" in
configure)
+ . /usr/share/bacula-common/common-functions.dpkg
+ readOrCreatePasswords
+
check_and_fix_unsafe_director_password bacula-director-$THISDB
echo -n "Processing configuration..."
diff --git a/debian/bacula-director-db.postrm.in b/debian/bacula-director-db.postrm.in
index 5d7c8bf..11e2360 100644
--- a/debian/bacula-director-db.postrm.in
+++ b/debian/bacula-director-db.postrm.in
@@ -2,10 +2,7 @@
set -e
-
THISDB=XX_DB_XX
-CONFFILE=/etc/bacula/bacula-dir.conf
-
if [ -f /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
@@ -17,43 +14,6 @@ if [ -f /usr/share/dbconfig-common/dpkg/postrm.$THISDB ]; then
dbc_go bacula-director-$THISDB $@
fi
-
-case "$1" in
- purge)
- UCF_CONFIG_FILES="/etc/default/bacula-dir"
-
- # purge configs if there are no installed package
- # for other database type
- for CONF in $UCF_CONFIG_FILES; do
- if which ucfq >/dev/null && \
- ! (ucfq -w "$CONF" |egrep -q "^$CONF:bacula-director-$THISDB:");
- then
- continue
- fi
-
- rm -f "$CONF" "$CONF.ucf-old" "$CONF.ucf-new" "$CONF.ucf-dist"
-
- if which ucf >/dev/null; then
- ucf --purge "$CONF"
- fi
- if which ucfr >/dev/null; then
- ucfr --purge bacula-director-$THISDB "$CONF"
- fi
- done
- ;;
-esac
-
-# XXX disabled for now, the mechanism might be better used to create
-# an include for bacula-dir.conf?
-# remove and unregister dbc_database.conf on purge
-#if [ "$1" = "purge" ]; then
-# rm -f /etc/bacula/dbc_database.conf
-# if which ucf >/dev/null 2>&1; then
-# ucf --purge /etc/bacula/dbc_database.conf
-# ucfr --purge bacula-director-$THISDB /etc/bacula/dbc_database.conf
-# fi
-#fi
-
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
diff --git a/debian/bacula-director.postinst b/debian/bacula-director.postinst
index 302c386..c6f1f4a 100644
--- a/debian/bacula-director.postinst
+++ b/debian/bacula-director.postinst
@@ -19,6 +19,19 @@ set -e
case "$1" in
configure)
+ . /usr/share/bacula-common/common-functions.dpkg
+
+ # handle /etc/default/bacula-dir
+ #
+ # take over ownership of /etc/default/bacula-dir
+ # (also if previous version is empty)
+ if dpkg --compare-versions "$3" lt "7.4.3+dfsg-5"; then
+ ucfr -f bacula-director /etc/default/bacula-dir
+ fi
+ setup_etc_default bacula-director $@
+
+ # handle /etc/bacula/scripts/delete_catalog_backup
+ #
if [ -r /usr/share/bacula-common/dbc_database.conf ] ; then
. /usr/share/bacula-common/dbc_database.conf
fi
diff --git a/debian/bacula-director.postrm b/debian/bacula-director.postrm
index a1fe0de..cc1ec81 100644
--- a/debian/bacula-director.postrm
+++ b/debian/bacula-director.postrm
@@ -4,7 +4,7 @@ set -e
PACKAGE=bacula-director
CONFFILE=/etc/bacula/bacula-dir.conf
-UCF_CONFFILES=/etc/bacula/scripts/delete_catalog_backup
+UCF_CONFFILES="/etc/bacula/scripts/delete_catalog_backup /etc/default/bacula-dir"
# start of libpostrm.inc.sh
#
diff --git a/debian/changelog b/debian/changelog
index 7acc136..c422c09 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,14 +1,17 @@
bacula (7.4.3+dfsg-5) unstable; urgency=medium
+ Continue reorganisation of packages:
+
* Don't delete all of /etc/bacula when purging bacula-common
* Rewrote most of the postrm scripts
+ * /etc/default/bacula-dir is now handled in bacula-director
- --
+ -- Carsten Leonhardt <leo at debian.org> Thu, 01 Sep 2016 08:48:38 +0200
bacula (7.4.3+dfsg-4) experimental; urgency=medium
* Fix init scripts to make sure the daemons can be stopped before
- upgrades or when /etc/defaults/bacula-* were edited
+ upgrades or when /etc/default/bacula-* were edited
(merged from 7.4.3+dfsg-1+sid1)
* Use /run and /run/lock instead of /var/run and /var/lock
@@ -400,7 +403,7 @@ bacula (5.2.6+dfsg-3) unstable; urgency=high
* debian/bacula-common.preinst:
+ add bacula into cdrom group (Closes: #520508).
* debian/additions/common-functions.dpkg:
- + force /etc/defaults/bacula-dir reregistration in ucf when changing
+ + force /etc/default/bacula-dir reregistration in ucf when changing
bacula-director database type, fix purging after this (Closes: #680051).
* debian/bacula-{console,console-qt,traymonitor}.postrm:
+ fix files left after package purging, thanks to Andreas Beckmann and
--
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