[pkg-bacula-commits] [bacula] 09/09: Make first ucf use more silent
Carsten Leonhardt
leo at moszumanska.debian.org
Wed Jul 20 10:57:38 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 0331c27f115b6e9ba51508d7dbba13f41c290d54
Author: Alexander Golovko <alexandro at ankalagon.ru>
Date: Thu Jun 7 00:36:01 2012 +0400
Make first ucf use more silent
When we upgrade from non-ucf packages version, old configs differ from new and
ucf ask a question to user even if old configs was not changed from dist.
Check if old configs was not change and silently replace them with new version
---
debian/additions/common-functions.dpkg | 63 ++++++++++++++++++++++++++++++----
1 file changed, 56 insertions(+), 7 deletions(-)
diff --git a/debian/additions/common-functions.dpkg b/debian/additions/common-functions.dpkg
index 7f98253..9b4d18e 100644
--- a/debian/additions/common-functions.dpkg
+++ b/debian/additions/common-functions.dpkg
@@ -46,6 +46,59 @@ EOF
#
+# Function for check if config file for old package version (without
+# ucf-managed configs) is not changed by local admin.
+# Usage: old_config_is_unchanged_dist <config file> <old package version>
+#
+
+old_config_is_unchanged_dist() {
+ local CONFIG OLD_VERSION CHECKSUM
+ CONFIG="$1"
+ OLD_VERSION="$2"
+
+ test -n "$OLD_VERSION" || return 1
+ dpkg --compare-versions "$OLD_VERSION" lt "5.2.6+dfsg-1" || return 1
+
+ # FIXME: password escaping
+ CHECKSUM=$(cat "$CONFIG" |sed -E \
+ -e 's/^# *For Bacula release .* -- debian/_RELEASE_/' \
+ -e "s/ $(hostname)-(fd|sd|mon|dir)/ _HOSTNAME_-\1/" \
+ -e "s/dbname = \"$DBNAME\"; dbuser = \"$DBUSER\"; dbpassword = \"$DBPASS\"/_DBCONN_/" \
+ -e "s/Password = \"$FDPASSWD\"/_FDPASSWD_/" \
+ -e "s/Password = \"$FDMPASSWD\"/_FDMPASSWD_/" \
+ -e "s/Password = \"$SDPASSWD\"/_SDPASSWD_/" \
+ -e "s/Password = \"$SDMPASSWD\"/_SDMPASSWD_/" \
+ -e "s/Password = \"$DIRPASSWD\"/_DIRPASSWD_/" \
+ -e "s/Password = \"$DIRMPASSWD\"/_DIRMPASSWD_/" \
+ -e "s/Password = \"0Cv70F6pf01t6pB0opT4vQOnigDrR0v3L\"/_DIRPASSWD_/" \
+ -e "s/Password = \"4qByX84t7faibfxD34UltZ4qJ2USgj6\"/_DIRPASSWD_/" \
+ -e "s/Password = \"6SH38Ric1fyQb6xZ2mdp2nAQtvOGZOLJq\"/_DIRPASSWD_/" \
+ -e "s/Password = \"9UnjMj8qNDQyUL7YJpf6Ooe346e6o7VI\"/_DIRPASSWD_/" \
+ -e "s/Password = \"bP64DhKhdE3hFiwyt8ne5ZzWh9xjZvvCWvlB\\/SMJVtrp\"/_DIRPASSWD_/" \
+ -e "s/Password = \"BXROVXNeyF5no12LlPpoCtqSh1g3dHh7c\"/_DIRPASSWD_/" \
+ -e "s/Password = \"Cv70F6pf1t6pBopT4vQOnigDrR0v3L\"/_DIRPASSWD_/" \
+ -e "s/Password = \"EGNg0Zh0UDFJpO0eq69ol9R4Ig5Bni3Ly\"/_DIRPASSWD_/" \
+ -e "s/Password = \"h9Hw5bO1J8sf9gTwlEEZ3tJn4TcYo63yK\"/_DIRPASSWD_/" \
+ -e "s/Password = \"iEV3qaXATiZRiWi2Q3urnJ1oZLF3w3SMm\"/_DIRPASSWD_/" \
+ -e "s/Password = \"TtVEcetNhA2efDyQgHIHUdVObU5CdsI7WcodXdd+bynR\"/_DIRPASSWD_/" \
+ -e "s/Password = \"xtH4X+TgADrgVNwJ9yNJ5HFbOHS2Bm3YUzjdnyHEBfYw\"/_DIRPASSWD_/" \
+ |sha1sum |cut -b-40)
+
+ case "$(basename "$CONFIG"):$CHECKSUM" in
+ bacula-fd.conf:e91d730a9a45f3c894c432d7fe7a739cfeadc75d) return 0;;
+ bacula-sd.conf:58a01655b32c357f328e8f40b8af7d171ea429a3) return 0;;
+ bacula-dir.conf:02c9306f27a797cf391065f6212ca89b095b717c) return 0;;
+ bconsole.conf:b29d0c0725f84d0222f8e7580ace13b7a50f4b81) return 0;;
+ bat.conf:416388ccec8b270280f2d5375035c524798e8a9a) return 0;;
+ tray-monitor.conf:2a331d32836aa13ddceb7aa7f22456ccbf7c04b7) return 0;;
+ esac
+
+ return 1
+}
+
+
+
+#
# Function for substitute variables into template
# Usage: substitute <template> <output>
#
@@ -90,13 +143,9 @@ install_config() {
substitute "$TEMPLATE" "$tempfile"
- # TODO: add check for unchanged configs
- #if test -n "$OLD_VERSION" \
- # && dpkg --compare-versions "$OLD_VERSION" lt "5.2.6+dfsg-1" \
- # && UNCHANGED
- #then
- # cp "$tempfile" "$CONFIG"
- #fi
+ if old_config_is_unchanged_dist "$CONFIG" "$OLD_VERSION"; then
+ cp "$tempfile" "$CONFIG"
+ fi
ucf --debconf-ok --three-way "$tempfile" "$CONFIG"
ucfr "$PACKAGE" "$CONFIG"
--
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