[enh] Use ynh_backup helpers

This commit is contained in:
ljf 2020-12-09 01:35:40 +01:00
parent 2c9a668afe
commit ef9cc98d5e
2 changed files with 6 additions and 13 deletions

View file

@ -1,13 +1,8 @@
#!/bin/bash
# Exit hook on subcommand error or unset variable
set -eu
# Source YNH helpers
source /usr/share/yunohost/helpers
ynh_abort_if_errors
YNH_CWD="${YNH_BACKUP_DIR%/}/conf/dkim"
cd "$YNH_CWD"
# Backup destination
backup_dir="${1}/etc/dkim"
# Backup the configuration
ynh_backup "/etc/dkim" "$backup_dir"
ynh_backup --src_path="/etc/dkim"

View file

@ -1,11 +1,9 @@
#!/bin/bash
backup_dir="$1/etc/dkim"
backup_dir="$1/conf/dkim"
cp -a $backup_dir/. /etc/dkim
cp -a $backup_dir/etc/dkim/. /etc/dkim
chown -R root:root /etc/dkim
chown _rspamd:root /etc/dkim
chown _rspamd:root /etc/dkim/*.mail.key
chmod 600 /etc/dkim/*.mail.txt
chmod 400 /etc/dkim/*.mail.key