[Pkg-openldap-devel] [openldap] 05/29: r1434 at pulsar: torsten | 2005-03-15 00:54:42 +0100 * debian/slapd.postinst (compute_backup_path): Make function more robust in case we don't know the old version or the suffix of the database.

Timo Aaltonen tjaalton-guest at alioth.debian.org
Thu Oct 10 05:34:47 UTC 2013


This is an automated email from the git hooks/post-receive script.

tjaalton-guest pushed a commit to annotated tag 2.2.23-0.pre6
in repository openldap.

commit 14d6b3dc156b9a381e1422fd27d4a9eca717a91e
Author: Torsten Landschoff <torsten at debian.org>
Date:   Wed Mar 16 14:06:35 2005 +0000

     r1434 at pulsar:  torsten | 2005-03-15 00:54:42 +0100
      * debian/slapd.postinst (compute_backup_path): Make function more robust
        in case we don't know the old version or the suffix of the database.
---
 debian/changelog      |    2 ++
 debian/slapd.postinst |   18 ++++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a7f11f7..1e36d6e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ openldap2.2 (2.2.23-0.pre6) experimental; urgency=low
     functions.
   * debian/slapd.postinst: Make sure that debconf actually displays the
     error message even if the user has already seen it before.
+  * debian/slapd.postinst (compute_backup_path): Make function more robust
+    in case we don't know the old version or the suffix of the database.
 
  --
 
diff --git a/debian/slapd.postinst b/debian/slapd.postinst
index 7a1f428..3a03632 100644
--- a/debian/slapd.postinst
+++ b/debian/slapd.postinst
@@ -16,11 +16,25 @@ compute_backup_path() {							# {{{
 	dirname="$1"
 	basedn="$2"
 
-	echo -n "/var/backups/slapd-$OLD_VERSION"
+	# If we are installing from scratch and something got into the
+	# /var/lib/ldap directory it could well be that we don't have a 
+	# value for $OLD_VERSION - use the date and time instead
+	if [ "$OLD_VERSION" ]; then
+		echo -n "/var/backups/slapd-$OLD_VERSION/"
+	else
+		echo -n "/var/backups/slapd-`date +%Y%m%d-%H:%M:%S`/"
+	fi
+
+	# Just as well we can know the suffix if we were able to parse the
+	# config file or not. If the latter we use the name "unknown"
+	# as the final path element.
 	if [ "$basedn" ]; then
 		echo -n "$basedn"
+	else
+		echo -n "unknown"
 	fi
 }
+
 # }}}
 move_old_database_away() {						# {{{
 # Move the old database away if it is still there
@@ -46,7 +60,7 @@ move_old_database_away() {						# {{{
 	# include mount points as well anyway, but it's much less likely.
 	db_get slapd/move_old_database
 	if [ "$RET" = true ]; then
-		echo -n "  Moving $databasedir/* to $backupdir... " >&2
+		echo -n "  Moving $databasedir to $backupdir... " >&2
 		mkdir -p "$backupdir"
 		mv "$databasedir"/* "$backupdir"/
 		echo done. >&2

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-openldap/openldap.git



More information about the Pkg-openldap-devel mailing list