aports/main/openldap/slapd.initd
2022-11-06 02:49:31 +01:00

53 lines
1 KiB
Bash

#!/sbin/openrc-run
name="LDAP server"
description_checkconfig="Check configuration files for errors"
extra_commands="checkconfig"
: ${start_wait=50} # milliseconds
command="/usr/sbin/slapd"
cfg_opt="${cfgdir:+"-F $cfgdir"} ${cfgfile:+"-f $cfgfile"}"
command_args="
-u ldap -g ldap
-l DAEMON
${listen_uris:+-h \"$listen_uris\"}
-d0
$cfg_opt
${command_args-}
"
command_background=yes
pidfile="/run/$RC_SVCNAME.pid"
stopsig=2
start_stop_daemon_args="
${start_wait:+--wait $start_wait}
${start_stop_daemon_args-}
"
# See https://github.com/OpenRC/openrc/pull/558
supervise_daemon_args=" $supervise_daemon_args"
depend() {
need net
after firewall
before dbus hald avahi-daemon
provide ldap
}
start_pre() {
export KRB5_KTNAME
# NOTE: This directory is not used by default, it's created mainly for
# backward compatibility.
checkpath -d -o ldap:ldap /run/openldap || return 1
/usr/sbin/slaptest -u -Q $cfg_opt || /usr/sbin/slaptest -u $cfg_opt
}
checkconfig() {
ebegin "Checking $name configuration"
/usr/sbin/slaptest -u $cfg_opt
eend $?
}