aboutsummaryrefslogtreecommitdiffstats
path: root/main/openldap/slapd.initd
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/openldap/slapd.initd
parentb0412f61866d8afe9ca38cc6e91eb4e208fa9e3b (diff)
downloadaports-37aedafe0391550421f305e72e6fb9e23f768687.tar.bz2
aports-37aedafe0391550421f305e72e6fb9e23f768687.tar.xz
main/openldap: rewrite runscript
Diffstat (limited to 'main/openldap/slapd.initd')
-rw-r--r--main/openldap/slapd.initd44
1 files changed, 18 insertions, 26 deletions
diff --git a/main/openldap/slapd.initd b/main/openldap/slapd.initd
index 47cb7feb38..350cc0d50a 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 $?
}