#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/strongswan/testing/hosts/winnetou/etc/init.d/slapd,v 1.2 2005/05/31 14:04:43 as Exp $

depend() {
	need net
}

start() {
	ebegin "Starting ldap-server"
	eval start-stop-daemon --start --quiet --pidfile /var/run/openldap/slapd.pid --exec /usr/lib/openldap/slapd -- -u ldap -g ldap "${OPTS}"
	eend $?
	if [ ! -e /var/lib/openldap-data/objectClass.bdb ]
	then
		sleep 5
		ldapadd -x -D "cn=Manager, o=Linux strongSwan, c=CH" -w tuxmux -f /etc/openldap/ldif.txt
	fi
}

stop() {
	ebegin "Stopping ldap-server"
	start-stop-daemon --stop --signal 2 --quiet --pidfile /var/run/openldap/slapd.pid 
	eend $?
}
