File: slapd-init.in

package info (click to toggle)
heimdal 7.1.0%2Bdfsg-13%2Bdeb9u3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 41,436 kB
  • sloc: ansic: 354,938; sh: 12,104; makefile: 4,353; yacc: 1,774; perl: 1,572; python: 748; lex: 732; java: 119; awk: 41
file content (48 lines) | stat: -rw-r--r-- 1,272 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh 
# $Id$

srcdir=@srcdir@

rm -rf db schema
mkdir db

# kill of old slapd if running
sh "${srcdir}/slapd-stop" > /dev/null

SCHEMA_NEEDED="hdb core nis cosine inetorgperson openldap samba"

SCHEMA_PATHS="${srcdir}/../../lib/hdb ${srcdir} /etc/ldap/schema /etc/openldap/schema /private/etc/openldap/schema /usr/share/openldap/schema"

test -d schema || mkdir schema

# setup needed schema files
for f in $SCHEMA_NEEDED; do
    if [ ! -r schema/$f.schema ]; then
	for d in $SCHEMA_PATHS ; do
	    if [ -r $d/$f.schema ] ; then
		cp $d/$f.schema schema/$f.schema
		continue 2
	    fi
	done
	echo "SKIPPING TESTS: you need the following schema file: $f.schema"
	exit 1
    fi
done

touch modules.conf || exit 1

if ! slapadd -d 0 -f "${srcdir}/slapd.conf" < "${srcdir}/init.ldif"; then
    echo "moduleload back_bdb.la"   >> modules.conf
    if ! slapadd -d 0 -f "${srcdir}/slapd.conf" < "${srcdir}/init.ldif"; then
        echo "modulepath /usr/lib/ldap"  > modules.conf
        echo "moduleload back_bdb.la"   >> modules.conf
        slapadd -d 0 -f "${srcdir}/slapd.conf" < "${srcdir}/init.ldif" || exit 1
    fi
fi

cp "`which slapd`" . || true # fails if running

echo "starting slapd"
./slapd -d0 -f "${srcdir}/slapd.conf" -h ldapi://.%2Fldap-socket &

sleep 4