summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-10-26 20:27:43 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-10-26 21:14:51 +0200
commit37aedafe0391550421f305e72e6fb9e23f768687 (patch)
treed4167fb266c4ccc770b0f70060d0e84129f2eee5 /main
parentb0412f61866d8afe9ca38cc6e91eb4e208fa9e3b (diff)
downloadaports-37aedafe0391550421f305e72e6fb9e23f768687.zip
main/openldap: rewrite runscript
Diffstat (limited to 'main')
-rw-r--r--main/openldap/APKBUILD7
-rw-r--r--main/openldap/slapd.confd15
-rw-r--r--main/openldap/slapd.initd44
3 files changed, 31 insertions, 35 deletions
diff --git a/main/openldap/APKBUILD b/main/openldap/APKBUILD
index a8f200c39ac..1094c969090 100644
--- a/main/openldap/APKBUILD
+++ b/main/openldap/APKBUILD
@@ -111,10 +111,11 @@ package() {
# Move executable from lib to sbin.
mv usr/lib/slapd usr/sbin/
- sed -i -e 's:/var/lib/openldap/run:/var/run/openldap:g' \
+ sed -i -e 's:/var/lib/openldap/run:/run/openldap:g' \
-e 's:back_bdb.la:back_bdb.so:' \
-e 's:back_hdb.la:back_hdb.so:' \
-e 's:back_ldap.la:back_ldap.so:' \
+ -e '/slapd\.pid/i # If you change this, adjust also runscript!' \
etc/openldap/slapd.conf
chgrp ldap etc/openldap/slapd.conf
chmod g+r etc/openldap/slapd.conf
@@ -176,5 +177,5 @@ d94f791ff3d10f1fe244a6a071331d6dd5933ed859e1cf9465654e650ff7223eedad5f054ad77de2
9c7f41279e91ed995c91e9a8c543c797d9294a93cf260afdc03ab5777e45ed045a4d6a4d4d0180b5dc387dc04babca01d818fbfa8168309df44f4500d2a430a4 openldap-mqtt-overlay.patch
cbfd573139e6b0c51d0f1f1337d74d5c07813509754758df240b09bc2ba559127f656580eef88f1db1c1322d7cb05042b1926e046e24c19889759647aee7aec6 libressl.patch
8c4244d316a05870dd1147b2ab7ddbcfd7626b5dce2f5a0e72f066dc635c2edb4f1ea3be88c6fec2d5ab016001be16bedef70f2ce0695c3cd96f69e1614ff177 fix-manpages.patch
-1e49068503a0e6c467f981b6fad8ef157fbd36c41a8a65bad3d3e138a5fc56ea628e8daa5d8745d91e818ef2d6f2b4343c0f047aba0fb81f4fd789f947c9882c slapd.initd
-8290769b63b3a5863622de2deb9269a0711ba5f4a225eb230d7c5097937b9d4e8cf5a998ee99232824e2335ae1b6e0114357b61c9611bc2460ebd195d12eabae slapd.confd"
+0c3606e4dad1b32f1c4b62f2bc1990a4c9f7ccd10c7b50e623309ba9df98064e68fc42a7242450f32fb6e5fa2203609d3d069871b5ae994cd4b227a078c93532 slapd.initd
+64dc4c0aa0abe3d9f7d2aef25fe4c8e23c53df2421067947ac4d096c9e942b26356cb8577ebc41b52d88d0b0a03b2a3e435fe86242671f9b36555a5f82ee0e3a slapd.confd"
diff --git a/main/openldap/slapd.confd b/main/openldap/slapd.confd
index 2240ad3f302..f69f92b4ab0 100644
--- a/main/openldap/slapd.confd
+++ b/main/openldap/slapd.confd
@@ -1,9 +1,12 @@
-# conf.d file for openldap
-#
+# Configuration for /etc/init.d/slapd
+
+# Location of the configuration file.
+cfgfile="/etc/openldap/slapd.conf"
+
+# Location of the configuration directory (OpenLDAP 2.3+).
+#cfgdir=""
+
# To enable both the standard unciphered server and the ssl encrypted
# one uncomment this line or set any other server starting options
# you may desire.
-#
-# OPTS="-h 'ldaps:// ldap:// ldapi://%2fvar%2frun%2fopenldap%2fslapd.sock'"
-# Uncomment the below to use the new slapd configuration for openldap 2.3
-#OPTS="-F /etc/openldap/slapd.d -h 'ldaps:// ldap:// ldapi://%2fvar%2frun%2fopenldap%2fslapd.sock'"
+#command_args="-h 'ldaps:// ldap:// ldapi://%2fvar%2frun%2fopenldap%2fslapd.sock'"
diff --git a/main/openldap/slapd.initd b/main/openldap/slapd.initd
index 47cb7feb38f..350cc0d50a8 100644
--- a/main/openldap/slapd.initd
+++ b/main/openldap/slapd.initd
@@ -1,12 +1,19 @@
#!/sbin/openrc-run
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-nds/openldap/files/slapd-initd-2.4.28-r1,v 1.2 2012/02/12 21:35:04 robbat2 Exp $
+: ${pidfile:="/run/openldap/slapd.pid"}
+
+name="LDAP server"
extra_commands="checkconfig"
-pidfile=/var/run/openldap/${SVCNAME}.pid
+description_checkconfig="Check slapd.conf for errors"
+
+command="/usr/sbin/slapd"
+# OPTS is for backward compatibility
+cfg_opt="${cfgdir:+"-F $cfgdir"} ${cfgfile:+"-f $cfgfile"}"
+command_args="-u ldap -g ldap $cfg_opt ${command_args:-${OPTS:-}}"
-[ -z "$INSTANCE" ] && INSTANCE="openldap${SVCNAME#slapd}"
+stopsig=2
+start_stop_daemon_args="
+ ${KRB5_KTNAME:+"--env KRB5_KTNAME=$KRB5_KTNAME"}"
depend() {
need net
@@ -15,28 +22,13 @@ depend() {
provide ldap
}
-start() {
- checkpath --directory --owner ldap:ldap ${pidfile%/*}
- if ! checkconfig -Q ; then
- eerror "There is a problem with your slapd.conf!"
- return 1
- fi
- ebegin "Starting ldap-server"
- [ -n "$KRB5_KTNAME" ] && export KRB5_KTNAME
- eval start-stop-daemon --start \
- --pidfile ${pidfile} \
- --exec /usr/sbin/slapd \
- -- \
- -u ldap -g ldap "${OPTS}"
- eend $?
-}
-
-stop() {
- ebegin "Stopping ldap-server"
- start-stop-daemon --stop --signal 2 --quiet --pidfile ${pidfile}
- eend $?
+start_pre() {
+ checkpath --directory --owner ldap:ldap "${pidfile%/*}"
+ /usr/sbin/slaptest -u -Q $cfg_opt || /usr/sbin/slaptest -u $cfg_opt
}
checkconfig() {
- /usr/sbin/slaptest -u "$@" ${OPTS_CONF}
+ ebegin "Checking $name configuration..."
+ /usr/sbin/slaptest -u $cfg_opt
+ eend $?
}