mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Backup/restore also slapd.ldif
We need this because the regen-conf need to get the state of the slapd config database if it is customized or not and if some update are need.
This commit is contained in:
parent
7c10ea6b93
commit
f22f64103a
2 changed files with 4 additions and 0 deletions
|
@ -11,6 +11,7 @@ backup_dir="${1}/conf/ldap"
|
||||||
|
|
||||||
# Backup the configuration
|
# Backup the configuration
|
||||||
ynh_backup "/etc/ldap/ldap.conf" "${backup_dir}/ldap.conf"
|
ynh_backup "/etc/ldap/ldap.conf" "${backup_dir}/ldap.conf"
|
||||||
|
ynh_backup "/etc/ldap/slapd.ldif" "${backup_dir}/slapd.ldif"
|
||||||
slapcat -b cn=config -l "${backup_dir}/cn=config.master.ldif"
|
slapcat -b cn=config -l "${backup_dir}/cn=config.master.ldif"
|
||||||
|
|
||||||
# Backup the database
|
# Backup the database
|
||||||
|
|
|
@ -40,6 +40,9 @@ else
|
||||||
mv /etc/ldap/slapd.d "$TMPDIR"
|
mv /etc/ldap/slapd.d "$TMPDIR"
|
||||||
mkdir -p /etc/ldap/slapd.d
|
mkdir -p /etc/ldap/slapd.d
|
||||||
cp -a "${backup_dir}/ldap.conf" /etc/ldap/ldap.conf
|
cp -a "${backup_dir}/ldap.conf" /etc/ldap/ldap.conf
|
||||||
|
cp -a "${backup_dir}/slapd.ldif" /etc/ldap/slapd.ldif
|
||||||
|
# Legacy thing but we need it to force the regen-conf in case of it exist
|
||||||
|
cp -a "${backup_dir}/slapd.conf" /etc/ldap/slapd.conf
|
||||||
slapadd -F /etc/ldap/slapd.d -b cn=config \
|
slapadd -F /etc/ldap/slapd.d -b cn=config \
|
||||||
-l "${backup_dir}/cn=config.master.ldif" \
|
-l "${backup_dir}/cn=config.master.ldif" \
|
||||||
|| die 1 "Unable to restore LDAP configuration"
|
|| die 1 "Unable to restore LDAP configuration"
|
||||||
|
|
Loading…
Add table
Reference in a new issue