Home | History | Annotate | Line # | Download | only in scripts
      1       1.1     lukem #! /bin/sh
      2   1.1.1.4      tron # $OpenLDAP$
      3       1.1     lukem ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
      4       1.1     lukem ##
      5  1.1.1.10  christos ## Copyright 1998-2024 The OpenLDAP Foundation.
      6       1.1     lukem ## All rights reserved.
      7       1.1     lukem ##
      8       1.1     lukem ## Redistribution and use in source and binary forms, with or without
      9       1.1     lukem ## modification, are permitted only as authorized by the OpenLDAP
     10       1.1     lukem ## Public License.
     11       1.1     lukem ##
     12       1.1     lukem ## A copy of this license is available in the file LICENSE in the
     13       1.1     lukem ## top-level directory of the distribution or, alternatively, at
     14       1.1     lukem ## <http://www.OpenLDAP.org/license.html>.
     15       1.1     lukem 
     16       1.1     lukem echo "running defines.sh"
     17       1.1     lukem . $SRCDIR/scripts/defines.sh
     18       1.1     lukem 
     19       1.1     lukem mkdir -p $TESTDIR $DBDIR1
     20       1.1     lukem 
     21       1.1     lukem echo "Running slapadd to build slapd database..."
     22       1.1     lukem . $CONFFILTER $BACKEND < $CONF > $ADDCONF
     23       1.1     lukem $SLAPADD -f $ADDCONF -l $LDIFORDERED
     24       1.1     lukem RC=$?
     25       1.1     lukem if test $RC != 0 ; then
     26       1.1     lukem 	echo "slapadd failed ($RC)!"
     27       1.1     lukem 	exit $RC
     28       1.1     lukem fi
     29       1.1     lukem 
     30       1.1     lukem echo "Starting slapd on TCP/IP port $PORT1..."
     31       1.1     lukem . $CONFFILTER $BACKEND < $CONF > $CONF1
     32   1.1.1.9  christos $SLAPD -f $CONF1 -h $URI1 -d $LVL >> /dev/null 2>&1 &
     33       1.1     lukem PID=$!
     34       1.1     lukem 
     35       1.1     lukem echo "Using ldapsearch to retrieve all the entries..."
     36       1.1     lukem for i in 0 1 2 3 4 5; do
     37   1.1.1.9  christos 	$LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 > $SEARCHOUT 2>&1
     38       1.1     lukem 	RC=$?
     39       1.1     lukem 	if test $RC = 1 ; then
     40       1.1     lukem 		echo "Waiting 5 seconds for slapd to start..."
     41       1.1     lukem 		sleep 5
     42       1.1     lukem 	fi
     43       1.1     lukem done
     44       1.1     lukem 
     45       1.1     lukem if test $RC != 0 ; then
     46       1.1     lukem 	echo "ldapsearch failed ($RC)!"
     47       1.1     lukem 	exit $RC
     48       1.1     lukem fi
     49       1.1     lukem 
     50       1.1     lukem echo "Filtering ldapsearch results..."
     51   1.1.1.3      adam $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
     52       1.1     lukem echo "Filtering original ldif used to create database..."
     53   1.1.1.3      adam $LDIFFILTER < $LDIF > $LDIFFLT
     54       1.1     lukem echo "Comparing filter output..."
     55       1.1     lukem $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
     56       1.1     lukem 
     57       1.1     lukem if test $? != 0 ; then
     58       1.1     lukem 	echo "comparison failed - database was not created correctly"
     59       1.1     lukem 	exit 1
     60       1.1     lukem fi
     61       1.1     lukem 
     62       1.1     lukem echo ">>>>> Server1 (pid=$PID) started"
     63       1.1     lukem exit 0
     64