#!/bin/sh
#
# Rebuild the test environment from scratch
#
# andrew.findlay@skills-1st.co.uk
#
# $Id$

PROG=`basename "$0"`

# Allow for this being run from the top level of the example tree
#
if test -d openldap
then
	cd openldap
fi

# Sanity check
#
if test ! -f slapd.conf
then
	echo "$PROG: cannot find slapd.conf" 1>&2
	exit 1
fi

# Stop the server and clear out the database
#
x-stop-ldap
sleep 1
rm openldap-db/* > /dev/null 2>&1
x-start-ldap
sleep 1

# Move up the directory structure if necessary
#
if test ! -x build -a -x ../build
then
	cd ..
fi

# Sanity check
#
if test ! -x build
then
	echo "$PROG: cannot find build script" 1>&2
	exit 1
fi

# Now build the example DIT
./build

