borgmatic-base/scripts/openldap

29 lines
476 B
Bash

#!/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