[pkg-bacula-commits] [bacula] 04/09: manage bacula-sd configs with ucf
Carsten Leonhardt
leo at moszumanska.debian.org
Wed Jul 20 10:57:37 UTC 2016
This is an automated email from the git hooks/post-receive script.
leo pushed a commit to tag development/migrate-to-ucf-2012-06-07
in repository bacula.
commit 6534ce57d6e6828f274499de17bafe2dc987bb93
Author: Alexander Golovko <alexandro at ankalagon.ru>
Date: Wed Jun 6 13:22:13 2012 +0400
manage bacula-sd configs with ucf
---
debian/bacula-sd.postinst | 61 ++++++++---------------------------------------
debian/bacula-sd.postrm | 49 ++++++++++---------------------------
2 files changed, 23 insertions(+), 87 deletions(-)
diff --git a/debian/bacula-sd.postinst b/debian/bacula-sd.postinst
index b94475a..fbb1fdb 100644
--- a/debian/bacula-sd.postinst
+++ b/debian/bacula-sd.postinst
@@ -1,71 +1,30 @@
#!/bin/sh
-# postinst script for bacula-sd
-#
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'.
-
-SRCDIR="/usr/share/bacula-common/defconfig"
-DSTDIR="/etc/bacula"
-CONFIG="bacula-sd.conf"
+
. /usr/share/bacula-common/common-functions.dpkg
-readOrCreatePasswords
setup_etc_default bacula-sd $@
-case "$1" in
- configure)
-
- if [ ! -f $DSTDIR/$CONFIG ]; then
- TARGET=$DSTDIR/$CONFIG
- else
- TARGET=$DSTDIR/$CONFIG.dist
- fi
-
- sed -e s~@debian_hostname@~`hostname`~ \
- -e s~XXX_SDPASSWORD_XXX~$SDPASSWD~ \
- -e s~XXX_MONSDPASSWORD_XXX~$SDMPASSWD~ < $SRCDIR/$CONFIG > $TARGET
-
- # Harden permissions, so that passwords can not be looked at
- chown bacula:bacula $TARGET
- chmod 640 $TARGET
- ;;
-
- abort-upgrade|abort-remove|abort-deconfigure)
- ;;
+case "$1" in
+ configure)
+ CONFIG="/etc/bacula/bacula-sd.conf"
+ readOrCreatePasswords
- *)
- echo "postinst called with unknown argument \`$1'" >&2
- exit 1
- ;;
+ install_config bacula-sd "$CONFIG" "$2"
+ chown root:bacula "$CONFIG"
+ chmod 640 "$CONFIG"
esac
+
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
-
-
diff --git a/debian/bacula-sd.postrm b/debian/bacula-sd.postrm
index 30c3059..d969571 100644
--- a/debian/bacula-sd.postrm
+++ b/debian/bacula-sd.postrm
@@ -1,48 +1,25 @@
#! /bin/sh
-# postrm script for bacula
-#
-# see: dh_installdeb(1)
set -e
-# summary of how this script can be called:
-# * <postrm> `remove'
-# * <postrm> `purge'
-# * <old-postrm> `upgrade' <new-version>
-# * <new-postrm> `failed-upgrade' <old-version>
-# * <new-postrm> `abort-install'
-# * <new-postrm> `abort-install' <old-version>
-# * <new-postrm> `abort-upgrade' <old-version>
-# * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
case "$1" in
purge)
- rm -f /etc/bacula/bacula-sd.*
-
- # purge /etc/default/bacula-sd
- rm -f /etc/default/bacula-sd /etc/default/bacula-sd.ucf-old \
- /etc/default/bacula-sd.ucf-new /etc/default/bacula-sd.ucf-dist
- if which ucf >/dev/null; then
- ucf --purge /etc/default/bacula-sd
- fi
- if which ucfr >/dev/null; then
- ucfr --purge bacula-sd /etc/default/bacula-sd
- fi
- ;;
-
- remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-
- ;;
-
- *)
- echo "postrm called with unknown argument \`$1'" >&2
- exit 1
-
+ CONFIG_FILES="/etc/bacula/bacula-sd.conf /etc/default/bacula-sd"
+
+ for CONF in $CONFIG_FILES; do
+ 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-sd "$CONF"
+ fi
+ done
esac
+
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
--
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