[Pkg-openldap-devel] Bug#403948: Patch to allow local slapd/slurpd binary locations

Davor Ocelic docelic at mail.inet.hr
Wed Dec 20 22:01:32 CET 2006


Package: slapd
Version: 2.3.29-1
Severity: wishlist
Tags: patch


Hello,

Attached is a small patch that allows custom specification of 
slapd and slurpd binary paths in the /etc/default/slapd file,
through the use of SLAPD_DAEMON and SLURPD_DAEMON variables.

Together with the existing ability to specify custom slapd.conf
file, this allows for very convenient local replacement of slapd
with say, its custom-built version, while preserving the convenience
of /etc/default/slapd and /etc/init.d/slapd files.

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-3-amd64
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

-- debconf information excluded
-------------- next part --------------
--- /etc/init.d/slapd	2006-11-11 12:08:05.000000000 +0100
+++ /etc/init.d/slapd-local	2006-12-20 21:48:53.000000000 +0100
@@ -14,14 +14,23 @@
 # Kill me on all errors
 set -e
 
-# Stop processing if slapd is not there
-[ -x /usr/sbin/slapd ] || exit 0
-
 # Source the init script configuration
 if [ -f "/etc/default/slapd" ]; then
 	. /etc/default/slapd
 fi
 
+# Load the default location of slapd and slurpd binaries
+if [ -z "$SLAPD_DAEMON" ]; then
+	SLAPD_DAEMON="/usr/sbin/slapd"
+fi
+if [ -z "$SLURPD_DAEMON" ]; then
+	SLURPD_DAEMON="/usr/sbin/slurpd"
+fi
+
+# Stop processing if slapd is not there
+[ -x "$SLAPD_DAEMON" ] || exit 0
+
+
 # Load the default location of the slapd config file
 if [ -z "$SLAPD_CONF" ]; then
 	SLAPD_CONF="/etc/ldap/slapd.conf"
@@ -124,11 +133,11 @@
 	if [ -z "$SLAPD_SERVICES" ]; then
 		reason="`start-stop-daemon --start --quiet --oknodo \
 			--pidfile "$SLAPD_PIDFILE" \
-			--exec /usr/sbin/slapd -- $SLAPD_OPTIONS 2>&1`"
+			--exec $SLAPD_DAEMON -- $SLAPD_OPTIONS 2>&1`"
 	else
 		reason="`start-stop-daemon --start --quiet --oknodo \
 			--pidfile "$SLAPD_PIDFILE" \
-			--exec /usr/sbin/slapd -- -h "$SLAPD_SERVICES" $SLAPD_OPTIONS 2>&1`"
+			--exec $SLAPD_DAEMON -- -h "$SLAPD_SERVICES" $SLAPD_OPTIONS 2>&1`"
 	fi
 }
 
@@ -140,7 +149,7 @@
 	fi
 	echo -n " slurpd"
 	reason="`start-stop-daemon --start --quiet --oknodo \
-		--exec /usr/sbin/slurpd -- $SLURPD_OPTIONS 2>&1`"
+		--exec $SLURPD_DAEMON -- $SLURPD_OPTIONS 2>&1`"
 }
 
 # Stop the slapd daemon and capture the error message (if any) to
@@ -149,7 +158,7 @@
 	echo -n " slapd"
 	reason="`start-stop-daemon --stop --quiet --oknodo --retry 10 \
 		--pidfile "$SLAPD_PIDFILE" \
-		--exec /usr/sbin/slapd 2>&1`"
+		--exec $SLAPD_DAEMON 2>&1`"
 }
 
 # Stop the slurpd daemon and capture the error message (if any) to
@@ -160,7 +169,7 @@
 	fi
 	echo -n " slurpd"
 	reason="`start-stop-daemon --stop --quiet --oknodo --retry 10 \
-		--exec /usr/sbin/slurpd 2>&1`"
+		--exec $SLURPD_DAEMON 2>&1`"
 }
 
 # Start the OpenLDAP daemons
--- slapd	2006-12-20 21:49:41.000000000 +0100
+++ slapd-local	2006-12-20 21:49:33.000000000 +0100
@@ -1,5 +1,7 @@
-# Default location of the slapd.conf file
+# Default location of the slapd.conf file and slapd/slurpd binaries
 SLAPD_CONF=
+SLAPD_DAEMON=
+SLURPD_DAEMON=
 
 # System account to run the slapd server under. If empty the server
 # will run as root.


More information about the Pkg-openldap-devel mailing list