#!/bin/bash
set -e
rootdn=`python -c "from eoleaaf.config import rootdn;print rootdn"`
rootdnpasswd=`python -c "from eoleaaf.config import rootdnpasswd;print rootdnpasswd"`
ldif_path=`python -c "from eoleaaf.config import ldif_path; print ldif_path"`
timestamppath="${ldif_path}/$(date +%s)"
/usr/sbin/parseaaf.py # pas de param => reset_db = False donc maj_mode=True
/usr/sbin/gentemplate.py delta
mkdir -p "$timestamppath"
/usr/sbin/genldif.py delta "$timestamppath"
ldap_delta_create_filename=`python -c "from eoleaaf.config import ldap_delta_create_filename;print ldap_delta_create_filename"`
ldap_delta_update_filename=`python -c "from eoleaaf.config import ldap_delta_update_filename;print ldap_delta_update_filename"`
ldap_delta_delete_filename=`python -c "from eoleaaf.config import ldap_delta_delete_filename;print ldap_delta_delete_filename"`
ldapadd -c -D "$rootdn" -w "$rootdnpasswd" -f $timestamppath/$ldap_delta_create_filename
ldapmodify -c -D "$rootdn" -w "$rootdnpasswd" -f $timestamppath/$ldap_delta_delete_filename
ldapmodify -c -D "$rootdn" -w "$rootdnpasswd" -f $timestamppath/$ldap_delta_update_filename
