From ef9cc98d5e07dcc224ead8992bafc26f83c2acbd Mon Sep 17 00:00:00 2001 From: ljf Date: Wed, 9 Dec 2020 01:35:40 +0100 Subject: [PATCH] [enh] Use ynh_backup helpers --- data/hooks/backup/22-conf_mail | 13 ++++--------- data/hooks/restore/22-conf_mail | 6 ++---- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/data/hooks/backup/22-conf_mail b/data/hooks/backup/22-conf_mail index 018a345d9..9db39e0c2 100644 --- a/data/hooks/backup/22-conf_mail +++ b/data/hooks/backup/22-conf_mail @@ -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" diff --git a/data/hooks/restore/22-conf_mail b/data/hooks/restore/22-conf_mail index 312b3f61b..77e0a4d42 100644 --- a/data/hooks/restore/22-conf_mail +++ b/data/hooks/restore/22-conf_mail @@ -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