ajout script d'export LDIF pour méta-annuaire PSL

This commit is contained in:
Benjamin Dauvergne 2016-07-05 20:20:54 +02:00
parent 4d1b2ad536
commit 64c09cc913
2 changed files with 20 additions and 0 deletions

1
debian/install vendored
View File

@ -1 +1,2 @@
schema.ldif /usr/share/python-curie
export-ldap2psl /usr/bin

19
export-ldap2psl Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
CREDENTIALS=${CREDENTIALS:--Y EXTERNAL -H ldapi://}
set -e
TMP=`tempfile`
LOG=`tempfile`
trap "rm $TMP $LOG" EXIT
if ldapsearch -L -E pr=2147483647/noprompt $CREDENTIALS -s base -b dc=curie,dc=fr '' objectClass dc supannEtablissement o >$TMP 2>$LOG && \
ldapsearch -L -E pr=2147483647/noprompt $CREDENTIALS -s base -b ou=people,dc=curie,dc=fr '' objectClass ou >>$TMP 2>$LOG && \
ldapsearch -L -E pr=2147483647/noprompt $CREDENTIALS -s one -b ou=people,dc=curie,dc=fr '' objectClass cn uid sn givenName supannEtablissement mail telephoneNumber supannListRouge >>$TMP 2>$LOG; then
echo 'version: 1'
cat $TMP | sed '/^version: 1/d' | sed '/^objectClass: icPerson/d'
exit 0
fi
echo Une erreur est survenue
cat $LOG
exit 1