[Pkg-openldap-devel] [openldap] 02/02: Back up old config before reconfiguring

Ryan Tandy rtandy-guest at moszumanska.debian.org
Mon Apr 17 03:24:28 UTC 2017


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

rtandy-guest pushed a commit to branch master
in repository openldap.

commit a1626dfc4f22ac474d475459157d2168b368c5ce
Author: Ryan Tandy <ryan at nardis.ca>
Date:   Sun Apr 16 10:51:16 2017 -0700

    Back up old config before reconfiguring
---
 debian/changelog            | 2 ++
 debian/slapd.postinst       | 2 --
 debian/slapd.scripts-common | 5 ++++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index fccb6b8..f8bce95 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -39,6 +39,8 @@ openldap (2.4.44+dfsg-4) UNRELEASED; urgency=medium
   * Dump the configuration and databases to LDIF before removing slapd, so 
     that they are available if a newer version requiring migration is 
     installed later. (Closes: #665199)
+  * When creating a new configuration with dpkg-reconfigure, back up the old 
+    configuration before overwriting it.
 
  -- Ryan Tandy <ryan at nardis.ca>  Sun, 08 Jan 2017 12:39:19 -0800
 
diff --git a/debian/slapd.postinst b/debian/slapd.postinst
index cf761fc..2f5c550 100644
--- a/debian/slapd.postinst
+++ b/debian/slapd.postinst
@@ -32,9 +32,7 @@ postinst_upgrade_configuration() {					# {{{
 # Usage: postinst_upgrade_configuration
 
 	# Better back up the config file in any case
-	echo -n "  Backing up $SLAPD_CONF in `database_dumping_destdir`... " >&2
 	backup_config_once
-	echo done. >&2
 
 	# Complete any config updates before trying to use slapadd
 	if [ -d "$SLAPD_CONF" ]; then
diff --git a/debian/slapd.scripts-common b/debian/slapd.scripts-common
index 2af6a88..74cc97e 100644
--- a/debian/slapd.scripts-common
+++ b/debian/slapd.scripts-common
@@ -452,6 +452,7 @@ create_new_configuration() {						# {{{
 	db_get slapd/backend
 	backend="`echo $RET|tr A-Z a-z`"
 
+	backup_config_once
 	if [ -e "/var/lib/ldap" ] && ! is_empty_dir /var/lib/ldap; then
 		echo >&2 "  Moving old database directory to /var/backups:"
 		move_old_database_away /var/lib/ldap
@@ -585,9 +586,11 @@ backup_config_once() {							# {{{
 	local backupdir
 
 	if [ -z "$FLAG_CONFIG_BACKED_UP" ]; then
-		backupdir=`database_dumping_destdir`
 		if [ -e "$SLAPD_CONF" ]; then
+			backupdir=`database_dumping_destdir`
+			echo -n "  Backing up $SLAPD_CONF in ${backupdir}... " >&2
 			cp -a "$SLAPD_CONF" "$backupdir"
+			echo done. >&2
 		fi
 		FLAG_CONFIG_BACKED_UP=yes
 	fi

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