[pkg-bacula-commits] [bacula] 04/07: handle bacula-dir.conf in package bacula-director
Carsten Leonhardt
leo at moszumanska.debian.org
Tue Sep 6 12:07:57 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 42af238a7a8218e81454545bdc58f1297646c895
Author: Carsten Leonhardt <leo at debian.org>
Date: Tue Sep 6 13:05:14 2016 +0200
handle bacula-dir.conf in package bacula-director
---
debian/TODO | 1 -
debian/bacula-director-db.postinst.in | 71 +----------------------------------
debian/bacula-director.postinst | 62 +++++++++++++++++++++---------
debian/changelog | 3 +-
4 files changed, 48 insertions(+), 89 deletions(-)
diff --git a/debian/TODO b/debian/TODO
index 98723df..71410d3 100644
--- a/debian/TODO
+++ b/debian/TODO
@@ -7,7 +7,6 @@ High:
Normal:
- * Handle bacula-dir.conf in package bacula-director
* Check if dh_exec can help us (architecture dependent *.install and
renames while installing)
* Check Depends on SQL-client-libraries, they might be obsoleted by dbconfig-*sql*
diff --git a/debian/bacula-director-db.postinst.in b/debian/bacula-director-db.postinst.in
index e3cbce3..330b5db 100644
--- a/debian/bacula-director-db.postinst.in
+++ b/debian/bacula-director-db.postinst.in
@@ -1,30 +1,12 @@
#!/bin/sh
-# postinst script for bacula-director-XX_DB_XX
-#
+
+# XXXXX TODO needs cleanup
set -e
. /usr/share/debconf/confmodule
db_version 2.0
-# 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>
-# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-# <failed-install-package> <version> `removing'
-# <conflicting-package> <version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-#
-# quoting from the policy:
-# Any necessary prompting should almost always be confined to the
-# post-installation script, and should be protected with a conditional
-# so that unnecessary prompting doesn't happen if a package's
-# installation fails and the `postinst' is called with `abort-upgrade',
-# `abort-remove' or `abort-deconfigure'.
-
THISDB=XX_DB_XX
case "$THISDB" in
@@ -54,55 +36,6 @@ if [ -f /usr/share/dbconfig-common/dpkg/postinst.$THISDB ]; then
dbc_go bacula-director-$THISDB $@
fi
-SRCDIR="/usr/share/bacula-common/defconfig"
-DSTDIR="/etc/bacula"
-CONFIG="bacula-dir.conf"
-TARGET=$DSTDIR/$CONFIG
-
-case "$1" in
-configure)
- . /usr/share/bacula-common/common-functions.dpkg
- readOrCreatePasswords
-
- #check_and_fix_unsafe_director_password bacula-director-$THISDB
-
- if [ ! -f $TARGET ]; then
- echo -n "No $CONFIG found, creating a new one..."
- install -m 640 -o root -g bacula $SRCDIR/$CONFIG $TARGET
-
- sed -e s~XXX_DIRPASSWORD_XXX~$DIRPASSWD~ \
- -e s~XXX_MONDIRPASSWORD_XXX~$DIRMPASSWD~ \
- -e s~XXX_SDPASSWORD_XXX~$SDPASSWD~ \
- -e s~XXX_FDPASSWORD_XXX~$FDPASSWD~ \
- -e "s~@debian_hostname@~`hostname`~" \
- -i $TARGET
-
- . /etc/dbconfig-common/bacula-director-$THISDB.conf
- if [ "$dbc_install" = "true" ] ; then
- case "$THISDB" in
- mysql | pgsql)
- sed -e "s/dbname = \"XXX_DBNAME_XXX\";/dbname = \"$dbc_dbname\"; DB Address = \"$dbc_dbserver\";/" \
- -e "s~/XXX_DBNAME_XXX~/$dbc_dbname~" \
- -e "s/XXX_DBUSER_XXX/$dbc_dbuser/" -e "s/XXX_DBPASSWORD_XXX/$dbc_dbpass/" \
- -i $TARGET
- ;;
- sqlite3)
- BACULADBNAME=`echo "$dbc_dbname" | sed 's/.db$//'`
- sed -e "s~/XXX_DBNAME_XXX~/$BACULADBNAME~" \
- -e "s~\"XXX_DBNAME_XXX~\"$BACULADBNAME~" \
- -e s~XXX_DBUSER_XXX~~ \
- -e s~XXX_DBPASSWORD_XXX~~ \
- -i $TARGET
- ;;
- esac
- fi
- echo "Ok."
- fi
- ;;
-esac
-
-
-
# Do start daemon
db_stop
diff --git a/debian/bacula-director.postinst b/debian/bacula-director.postinst
index c6f1f4a..1c56639 100644
--- a/debian/bacula-director.postinst
+++ b/debian/bacula-director.postinst
@@ -1,28 +1,18 @@
#!/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
+SRCDIR="/usr/share/bacula-common/defconfig"
+DSTDIR="/etc/bacula"
+CONFIG="bacula-dir.conf"
+TARGET=$DSTDIR/$CONFIG
case "$1" in
configure)
. /usr/share/bacula-common/common-functions.dpkg
- # handle /etc/default/bacula-dir
- #
+ ## 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
@@ -30,8 +20,44 @@ case "$1" in
fi
setup_etc_default bacula-director $@
- # handle /etc/bacula/scripts/delete_catalog_backup
- #
+ ## handle /etc/bacula/bacula-dir.conf
+
+ readOrCreatePasswords
+ if [ ! -f $TARGET ]; then
+ echo -n "No $CONFIG found, creating a new one..."
+ install -m 640 -o root -g bacula $SRCDIR/$CONFIG $TARGET
+
+ sed -e s~XXX_DIRPASSWORD_XXX~$DIRPASSWD~ \
+ -e s~XXX_MONDIRPASSWORD_XXX~$DIRMPASSWD~ \
+ -e s~XXX_SDPASSWORD_XXX~$SDPASSWD~ \
+ -e s~XXX_FDPASSWORD_XXX~$FDPASSWD~ \
+ -e "s~@debian_hostname@~`hostname`~" \
+ -i $TARGET
+
+ . /usr/share/bacula-common/dbc_database.conf
+ if [ "$dbc_install" = "true" ] ; then
+ case "$dbc_dbtype" in
+ mysql | pgsql)
+ sed -e "s/dbname = \"XXX_DBNAME_XXX\";/dbname = \"$dbc_dbname\"; DB Address = \"$dbc_dbserver\";/" \
+ -e "s~/XXX_DBNAME_XXX~/$dbc_dbname~" \
+ -e "s/XXX_DBUSER_XXX/$dbc_dbuser/" -e "s/XXX_DBPASSWORD_XXX/$dbc_dbpass/" \
+ -i $TARGET
+ ;;
+ sqlite3)
+ BACULADBNAME=`echo "$dbc_dbname" | sed 's/.db$//'`
+ sed -e "s~/XXX_DBNAME_XXX~/$BACULADBNAME~" \
+ -e "s~\"XXX_DBNAME_XXX~\"$BACULADBNAME~" \
+ -e s~XXX_DBUSER_XXX~~ \
+ -e s~XXX_DBPASSWORD_XXX~~ \
+ -i $TARGET
+ ;;
+ esac
+ fi
+ echo "Ok."
+ fi
+
+ ## 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/changelog b/debian/changelog
index 4151d7a..c7bc7d2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,7 +4,8 @@ bacula (7.4.3+dfsg-5) unstable; urgency=medium
* 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
+ * /etc/default/bacula-dir and bacula-dir.conf are now handled in package
+ bacula-director
* Cleanup of postinst scripts, safer password handling,
no longer create unneeded .dist files of config files (Closes: #493092)
* deleted obsolete code from various places in debian/*
--
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