[pkg-bacula-commits] [bacula] 07/09: manage bacula-console-qt 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 ca68d32251eebe8f49ba59be552e9e05b5c50d1c
Author: Alexander Golovko <alexandro at ankalagon.ru>
Date:   Wed Jun 6 21:30:21 2012 +0400

    manage bacula-console-qt configs with ucf
---
 debian/bacula-console-qt.postinst | 57 ++++++---------------------------------
 debian/bacula-console-qt.postrm   | 28 +++++++++++++++++++
 2 files changed, 36 insertions(+), 49 deletions(-)

diff --git a/debian/bacula-console-qt.postinst b/debian/bacula-console-qt.postinst
index 240f6a4..712b9c7 100644
--- a/debian/bacula-console-qt.postinst
+++ b/debian/bacula-console-qt.postinst
@@ -1,63 +1,22 @@
 #!/bin/sh
-# postinst script for bacula
-#
-# 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>
-#        * <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"
-CFGFILE="bat.conf"
 
 . /usr/share/bacula-common/common-functions.dpkg
-readOrCreatePasswords
-
-case "$1" in
-    configure)
-
-	if [ ! -f $DSTDIR/$CFGFILE ]; then
-		TARGET=$DSTDIR/$CFGFILE
-	else
-		TARGET=$DSTDIR/$CFGFILE.dist
-	fi
 
-	# bconsole & wx-console use the same config file ;)
-	sed -e "s~@debian_hostname@~localhost~" \
-	-e s~XXX_DIRPASSWORD_XXX~$DIRPASSWD~ \
-		< $SRCDIR/$CFGFILE > $TARGET
 
-	chown root:bacula $TARGET
-	chmod 640 $TARGET
-    ;;
-
-    abort-upgrade|abort-remove|abort-deconfigure)
-
-    ;;
+case "$1" in
+  configure)
+    CONFIG="/etc/bacula/bat.conf"
+    readOrCreatePasswords
 
-    *)
-        echo "postinst called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
+    install_config bacula-console-qt "$CONFIG" "$2"
+    chown root:root "$CONFIG"
+    chmod 0640 "$CONFIG"
 esac
 
+
 # dh_installdeb will replace this with shell code automatically
 # generated by other debhelper scripts.
 
diff --git a/debian/bacula-console-qt.postrm b/debian/bacula-console-qt.postrm
new file mode 100644
index 0000000..514c73a
--- /dev/null
+++ b/debian/bacula-console-qt.postrm
@@ -0,0 +1,28 @@
+#! /bin/sh
+
+set -e
+
+
+case "$1" in
+  purge)
+    CONFIG_FILES="/etc/bacula/bat.conf"
+
+    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-console-qt "$CONF"
+      fi
+    done
+esac
+
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0

-- 
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