[pkg-bacula-commits] [bacula] 08/09: manage bacula-traymonitor 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 ba4843e7cedc278c576f50d77a08259480c0cdce
Author: Alexander Golovko <alexandro at ankalagon.ru>
Date:   Wed Jun 6 21:33:20 2012 +0400

    manage bacula-traymonitor configs with ucf
---
 debian/bacula-traymonitor.postinst | 61 +++++---------------------------------
 debian/bacula-traymonitor.postrm   | 20 ++++++++-----
 2 files changed, 21 insertions(+), 60 deletions(-)

diff --git a/debian/bacula-traymonitor.postinst b/debian/bacula-traymonitor.postinst
index 3ccef7b..30bc192 100644
--- a/debian/bacula-traymonitor.postinst
+++ b/debian/bacula-traymonitor.postinst
@@ -1,70 +1,25 @@
 #!/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"
-CONFIG="tray-monitor.conf"
 
 . /usr/share/bacula-common/common-functions.dpkg
-readOrCreatePasswords
-
-case "$1" in
-    configure)
-
-        if [ ! -f $DSTDIR/$CONFIG ]; then
-            TARGET=$DSTDIR/$CONFIG
-        else
-            TARGET=$DSTDIR/$CONFIG.dist
-        fi
-
-	sed -e "s~@debian_hostname@~localhost~" \
-	-e s~XXX_MONDIRPASSWORD_XXX~$DIRMPASSWD~ \
-	-e s~XXX_MONFDPASSWORD_XXX~$FDMPASSWD~ \
-	-e s~XXX_MONSDPASSWORD_XXX~$SDMPASSWD~ \
-		< $SRCDIR/$CONFIG > $TARGET
-
-        chown root:bacula $TARGET
-        chmod 640 $TARGET
 
-    ;;
 
-    abort-upgrade|abort-remove|abort-deconfigure)
-
-    ;;
+case "$1" in
+  configure)
+    CONFIG="/etc/bacula/tray-monitor.conf"
+    readOrCreatePasswords
 
-    *)
-        echo "postinst called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
+    install_config bacula-traymonitor "$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-traymonitor.postrm b/debian/bacula-traymonitor.postrm
index 219fa81..4dcd3f5 100644
--- a/debian/bacula-traymonitor.postrm
+++ b/debian/bacula-traymonitor.postrm
@@ -3,14 +3,20 @@
 set -e
 
 
-CFGDIR=/etc/bacula
-CFGFILE="tray-monitor.conf"
-
-
 case "$1" in
-    purge)
-        rm -f $CFGDIR/$CFGFILE.*
-    ;;
+  purge)
+    CONFIG_FILES="/etc/bacula/tray-monitor.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-traymonitor "$CONF"
+      fi
+    done
 esac
 
 

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