[pkg-bacula-commits] [bacula] 03/09: manage bacula-fd 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 bb811942f6aad9c6c219823a761eae38a0229988
Author: Alexander Golovko <alexandro at ankalagon.ru>
Date: Tue Jun 5 19:13:43 2012 +0400
manage bacula-fd configs with ucf
---
debian/bacula-fd.postinst | 60 +++++++----------------------------------------
debian/bacula-fd.postrm | 50 ++++++++++-----------------------------
2 files changed, 22 insertions(+), 88 deletions(-)
diff --git a/debian/bacula-fd.postinst b/debian/bacula-fd.postinst
index d2fee5f..dab3c83 100644
--- a/debian/bacula-fd.postinst
+++ b/debian/bacula-fd.postinst
@@ -1,72 +1,30 @@
#!/bin/sh
-# postinst script for bacula-fd
-#
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-fd.conf"
. /usr/share/bacula-common/common-functions.dpkg
-readOrCreatePasswords
setup_etc_default bacula-fd $@
-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_FDPASSWORD_XXX~$FDPASSWD~ \
- -e s~XXX_MONFDPASSWORD_XXX~$FDMPASSWD~ < $SRCDIR/$CONFIG > $TARGET
-
-
- # Harden permissions, so that passwords can not be looked at
- chown root:root $TARGET
- chmod 640 $TARGET
- ;;
- abort-upgrade|abort-remove|abort-deconfigure)
-
- ;;
+case "$1" in
+ configure)
+ CONFIG="/etc/bacula/bacula-fd.conf"
+ readOrCreatePasswords
- *)
- echo "postinst called with unknown argument \`$1'" >&2
- exit 1
- ;;
+ install_config bacula-fd "$CONFIG" "$2"
+ chown root:root "$CONFIG"
+ chmod 0640 "$CONFIG"
esac
+
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
-
-
diff --git a/debian/bacula-fd.postrm b/debian/bacula-fd.postrm
index 940b91f..a4f7e43 100644
--- a/debian/bacula-fd.postrm
+++ b/debian/bacula-fd.postrm
@@ -1,49 +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-fd.*
-
- # purge /etc/default/bacula-fd
- rm -f /etc/default/bacula-fd /etc/default/bacula-fd.ucf-old \
- /etc/default/bacula-fd.ucf-new /etc/default/bacula-fd.ucf-dist
- if which ucf >/dev/null; then
- ucf --purge /etc/default/bacula-fd
- fi
- if which ucfr >/dev/null; then
- ucfr --purge bacula-fd /etc/default/bacula-fd
- 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-fd.conf /etc/default/bacula-fd"
+
+ 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-fd "$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