[Pkg-openldap-devel] [openldap] 26/39: r1724 at pulsar: torsten | 2005-04-14 11:46:27 +0200 * debian/slapd.postinst: Make a backup copy of slapd.conf before changing anything (closes: #304485).
Timo Aaltonen
tjaalton-guest at alioth.debian.org
Thu Oct 10 05:35:17 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-2
in repository openldap.
commit fa0ebbb2d331dcf525a0762ccbe202f70e203462
Author: Torsten Landschoff <torsten at debian.org>
Date: Thu Apr 14 10:39:42 2005 +0000
r1724 at pulsar: torsten | 2005-04-14 11:46:27 +0200
* debian/slapd.postinst: Make a backup copy of slapd.conf before changing
anything (closes: #304485).
---
debian/TODO | 2 --
debian/changelog | 2 ++
debian/slapd.postinst | 14 +++++++-----
debian/slapd.scripts-common | 50 ++++++++++++++++++++++++++++++++-----------
4 files changed, 48 insertions(+), 20 deletions(-)
diff --git a/debian/TODO b/debian/TODO
index f0caed6..ec64617 100644
--- a/debian/TODO
+++ b/debian/TODO
@@ -6,8 +6,6 @@ openldap2.2 (2.2.23-2) unstable; urgency=low
the upgrade may be problemated. Sketch the upgrade procedure.
* debian/README.Debian: Explain what to check for if upgrading fails and
how to recover.
- * TORSTEN: debian/slapd.postinst: Make a backup copy of slapd.conf before changing
- anything (closes: #304485).
* CARLO: debian/slapd.scripts-common: Handle all UTF-8 supported characters
in organization field by converting the locale specific input into
utf-8 and base64 encoding the result (closes: #236097).
diff --git a/debian/changelog b/debian/changelog
index 34bad49..7206e8c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,8 @@ openldap2.2 (2.2.23-2) unstable; urgency=low
+ Adapt to the DTSG (Debconf Templates Style Guide).
+ Removed item slapd/admin which is not used anymore.
+ Run debconf-updatepo and send new fr.po to Christian Perrier.
+ * debian/slapd.postinst: Make a backup copy of slapd.conf before changing
+ anything (closes: #304485).
--
diff --git a/debian/slapd.postinst b/debian/slapd.postinst
index 8f3d066..d2f6c85 100644
--- a/debian/slapd.postinst
+++ b/debian/slapd.postinst
@@ -19,12 +19,19 @@ if is_initial_configuration "$@"; then
echo " Omitting slapd configuration as requested." >&2
else
create_new_configuration
+ configure_v2_protocol_support
fi
+ exit
fi
# }}}
# Update configuration files for new features {{{
+# 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
+
configure_v2_protocol_support
if previous_version_older 2.1; then
autoconfigure_modules
@@ -34,11 +41,8 @@ update_access_config_directives
# During upgrading we have to load the old data
-# XXX: The if condition is preliminary -- Torsten
-if ! is_initial_configuration "$@"; then
- move_incompatible_databases_away
- load_databases
-fi
+move_incompatible_databases_away
+load_databases
db_stop || true
diff --git a/debian/slapd.scripts-common b/debian/slapd.scripts-common
index 9a0d378..4d7bc4e 100644
--- a/debian/slapd.scripts-common
+++ b/debian/slapd.scripts-common
@@ -77,10 +77,12 @@ database_format_changed() { # {{{
# }}}
database_dumping_destdir() { # {{{
-# Figure out the directory we are dumping the database to
+# Figure out the directory we are dumping the database to and create it
+# if it does not exist.
# Usage: destdir=`database_dumping_destdir`
db_get slapd/dump_database_destdir
+ mkdir -p -m 700 "$RET"
echo "$RET"|sed -e "s/VERSION/$OLD_VERSION/"
}
@@ -127,7 +129,6 @@ dump_databases() { # {{{
database_dumping_enabled || return 0
dir=`database_dumping_destdir`
- mkdir -p -m 700 "$dir"
echo >&2 " Dumping to $dir: "
parse_configuration_file
for db in `get_database_list`; do
@@ -494,11 +495,7 @@ create_new_slapd_conf() { # {{{
-e "s/@ADMIN@/cn=admin,$basedn/g" \
-e "s/@CHECKPOINT@/$checkpoint/g" \
-e "s/@BACKEND@/$backend/g"
- # Make sure we keep the permissions of an old slapd.conf
- if [ -e "$SLAPD_CONF" ]; then
- assign_permissions "$SLAPD_CONF" "$conf_new"
- fi
- mv $conf_new $SLAPD_CONF
+ install_new_slapd_conf "$conf_new"
echo "done." >&2
}
# }}}
@@ -586,8 +583,7 @@ autoconfigure_modules() { # {{{
's/^database[[:space:]]\+\([a-z]\+\)/moduleload back_\1/p'
echo >>$new_conf
cat $SLAPD_CONF >>$new_conf
- assign_permissions "$SLAPD_CONF" "$new_conf"
- mv $new_conf $SLAPD_CONF
+ install_new_slapd_conf "$new_conf"
echo done. >&2
}
# }}}
@@ -626,8 +622,7 @@ configure_v2_protocol_support() { # {{{
fi
# Activate the new configuration file
- assign_permissions "$SLAPD_CONF" "$new_conf"
- mv $new_conf $SLAPD_CONF
+ install_new_slapd_conf "$new_conf"
echo . >&2
}
# }}}
@@ -750,8 +745,7 @@ update_access_config_directives() { # {{{
-e 'next if not m/^access\s+to/;' \
-e 's/dn=/dn.regex=/g;' \
-e 's/attribute=/attrs=/g;' >"$new_conf"
- assign_permissions "$SLAPD_CONF" "$new_conf"
- mv "$new_conf" "$SLAPD_CONF"
+ install_new_slapd_conf "$new_conf"
echo done. >&2
} # }}}
@@ -780,6 +774,36 @@ stop_slapd() { # {{{
}
# }}}
+install_new_slapd_conf() { # {{{
+# Installs a given file as new slapd.conf configuration file.
+# Usage: install_new_slapd_conf <newfile>
+
+ local conf_new
+ conf_new="$1"
+
+ backup_configuration_once
+
+ # Make sure we keep the permissions of an old slapd.conf
+ if [ -e "$SLAPD_CONF" ]; then
+ assign_permissions "$SLAPD_CONF" "$conf_new"
+ fi
+ mv "$conf_new" "$SLAPD_CONF"
+}
+# }}}
+backup_configuration_once() { # {{{
+# Create a backup of the current configuration files.
+# Usage: backup_configuration_once
+
+ local backupdir
+
+ if [ -z "$FLAG_CONFIG_BACKED_UP" ]; then
+ backupdir=`database_dump_destdir`
+ if [ -e "$SLAPD_CONF" ]; then
+ cp -a "$SLAPD_CONF" "$backupdir"
+ fi
+ FLAG_CONFIG_BACKED_UP=yes
+ fi
+# }}}
# Set up the defaults for our templates
--
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