[Pkg-openldap-devel] [openldap] 01/14: r419 at pulsar: torsten | 2005-02-25 15:49:16 +0100 * debian/slapd.prerm: Rewrite and fix double stopping of slapd. Find out which bug we are working around and document it. --

Timo Aaltonen tjaalton-guest at alioth.debian.org
Thu Oct 10 05:34:27 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.pre3
in repository openldap.

commit 6ee50b481707edfbede50c5f05c02172cb1fc242
Author: Torsten Landschoff <torsten at debian.org>
Date:   Fri Feb 25 14:52:46 2005 +0000

     r419 at pulsar:  torsten | 2005-02-25 15:49:16 +0100
      * debian/slapd.prerm: Rewrite and fix double stopping of slapd. Find
        out which bug we are working around and document it.
     --
---
 debian/changelog   |    7 +++++++
 debian/slapd.prerm |   54 ++++++++++++++++++++++++++++++++++------------------
 2 files changed, 42 insertions(+), 19 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 8dd101d..49693f1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+openldap2.2 (2.2.23-0.pre3) experimental; urgency=low
+
+  * debian/slapd.prerm: Rewrite and fix double stopping of slapd. Find 
+    out which bug we are working around and document it.
+
+ --
+
 openldap2.2 (2.2.23-0.pre2) experimental; urgency=low
 
   * servers/slurpd/slurp.h: Relocate the default spool directory to 
diff --git a/debian/slapd.prerm b/debian/slapd.prerm
index a57fb6b..53605af 100755
--- a/debian/slapd.prerm
+++ b/debian/slapd.prerm
@@ -1,16 +1,27 @@
 #!/bin/sh
+
 set -e
 
-# Check if the old script, which called the main
-# init.d script, failed.
-# If it did we have to try something other than
-# just trying the same init.d script again.
-# Due to a bug in the old script it could fail
-# when slapd isn't running so here we'll basically
-# try the same start-stop-daemon call, but add
-# --oknodo so if the upgrade failed because it
-# wasn't there it'll work here.
-if [ "$1" = "failed-upgrade" ]; then
+# Work around bug introduced in 2.1.x, fixed in 2.1.22-2      		{{{
+
+# The slapd 2.1.x packages before 2.1.17-3 had a problem in the init.d
+# script. Namely if /etc/init.d/slapd stop was called and slapd was not
+# running, the init script failed with an error code. Problem is that 
+# the prerm called /etc/init.d/slapd stop which failed so the upgrade
+# breaks.  Same problem with slurpd, fixed in 2.1.22-2.
+#
+# dpkg calls the new prerm script if the old prerm failed so this is 
+# our chance to work around that problem by trying to kill slapd 
+# ourselves and ignoring the case that no slapd is running.
+#
+# Work around implemented by Stephen Frost, should go away one release
+# after sarge
+#
+# -- Torsten Landschoff <torsten at debian.org>  Fri, 25 Feb 2005 15:28:23 +0100
+
+if [ "$1" = "failed-upgrade"  ] \
+	&& dpkg --compare-versions "$2" -lt 2.1.22-2 \
+	&& dpkg --compare-versions "$2" -ge 2.1.0-1; then
 
 	# Source the init script configuration
 	if [ -f "/etc/default/slapd" ]; then
@@ -31,17 +42,22 @@ if [ "$1" = "failed-upgrade" ]; then
 	# Use the pidfile if it is there, if not then just do without
 	if [ -z "$SLAPD_PIDFILE" ]; then
 	        start-stop-daemon --stop --quiet --oknodo --retry 10 \
-			--exec /usr/sbin/slapd 2>&1
-	else
-	        start-stop-daemon --stop --quiet --oknodo --retry 10 --pidfile \"$SLAPD_PIDFILE\" \
-			--exec /usr/sbin/slapd 2>&1
-	fi
-elif [ -x "/etc/init.d/slapd" ]; then
-	if [ -x /usr/sbin/invoke-rc.d ] ; then
-		invoke-rc.d slapd stop
+			--exec /usr/sbin/slapd
 	else
-		/etc/init.d/slapd stop
+	        start-stop-daemon --stop --quiet --oknodo --retry 10 \
+			--pidfile \"$SLAPD_PIDFILE\" \
+			--exec /usr/sbin/slapd
 	fi
+
+	# Slurpd does not use a pidfile so just kill it via the exec
+	start-stop-daemon --stop --quiet --oknodo --retry 10 \
+		--exec /usr/sbin/slurpd
+
+	# Don't let debhelper try the same thing
+	exit
 fi
+# }}}
 
 #DEBHELPER#
+
+# vim: set foldmethod=marker:

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