#!/usr/bin/env bash
set -e
set -x
/etc/init.d/rsyslog start
/etc/init.d/slapd start
if slapcat -n 0 | grep -q olcModuleLoad; then
  ldapmodify -v -Q -Y EXTERNAL -H ldapi:/// -f openldap-memberof-modify.ldif
else
  ldapadd -v -Q -Y EXTERNAL -H ldapi:/// -f openldap-memberof-add.ldif
fi
ldapadd -v -Q -Y EXTERNAL -H ldapi:/// -f openldap-memberof-apply.ldif
ldapadd -v -x -D cn=admin,dc=nodomain -f /openldap-dit.ldif -w yoda
ldapmodify -v -Q -Y EXTERNAL -H ldapi:/// -f enable-debug-logging.ldif
