borgmatic-base/scripts/openldap

29 lines
476 B
Text
Raw Normal View History

2021-09-04 19:14:05 -04:00
#!/bin/bash
restoreDir=/etc/restore
ldapDir="$restoreDir/openldap"
hook_check() {
if [[ -d "$ldapDir" ]]; then
rm -rf "$ldapDir" || exit 1
fi
}
hook_pre() {
hook_check
mkdir -p "$ldapDir" || exit 1
slapcat -n 0 -l "$ldapDir/config.ldif"
slapcat -n 1 -l "$ldapDir/data.ldif"
}
hook_post() {
rm -rf "$ldapDir" || exit 1
}
case "$1" in
before_check) hook_check;;
before_backup) hook_pre;;
after_backup) hook_post;;
esac