mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
The configuration is now saved using slapcat instead of trying to generate it from slapd.conf - which generally fail at restoration. Also, a backup of configuration and database is made before the restoration, which allows to return to a "working" state if it fails.
16 lines
527 B
Bash
16 lines
527 B
Bash
#!/bin/bash
|
|
|
|
backup_dir="${1}/conf/ldap"
|
|
sudo mkdir -p "$backup_dir"
|
|
|
|
# Fix for first jessie yunohost where slapd.conf is called slapd-yuno.conf
|
|
# without slapcat doesn't work
|
|
[[ ! -f /etc/ldap/slapd.conf ]] \
|
|
&& sudo mv /etc/ldap/slapd-yuno.conf /etc/ldap/slapd.conf
|
|
|
|
# Back up the configuration
|
|
sudo cp -a /etc/ldap/slapd.conf "${backup_dir}/slapd.conf"
|
|
sudo slapcat -b cn=config -l "${backup_dir}/cn=config.master.ldif"
|
|
|
|
# Back up the database
|
|
sudo slapcat -b dc=yunohost,dc=org -l "${backup_dir}/dc=yunohost-dc=org.ldif"
|