From 9f599fee4c5959d76fcfda47380f93cb5752e80c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 5 Apr 2021 17:47:56 +0200 Subject: [PATCH] Re-add the certificate backup/restore hook ... --- data/hooks/backup/21-conf_ynh_certs | 13 +++++++++++++ data/hooks/restore/21-conf_ynh_certs | 7 +++++++ 2 files changed, 20 insertions(+) create mode 100644 data/hooks/backup/21-conf_ynh_certs create mode 100644 data/hooks/restore/21-conf_ynh_certs diff --git a/data/hooks/backup/21-conf_ynh_certs b/data/hooks/backup/21-conf_ynh_certs new file mode 100644 index 000000000..a3912a995 --- /dev/null +++ b/data/hooks/backup/21-conf_ynh_certs @@ -0,0 +1,13 @@ +#!/bin/bash + +# Exit hook on subcommand error or unset variable +set -eu + +# Source YNH helpers +source /usr/share/yunohost/helpers + +# Backup destination +backup_dir="${1}/conf/ynh/certs" + +# Backup certificates +ynh_backup "/etc/yunohost/certs" "$backup_dir" diff --git a/data/hooks/restore/21-conf_ynh_certs b/data/hooks/restore/21-conf_ynh_certs new file mode 100644 index 000000000..983bfb5a1 --- /dev/null +++ b/data/hooks/restore/21-conf_ynh_certs @@ -0,0 +1,7 @@ +backup_dir="$1/conf/ynh/certs" + +mkdir -p /etc/yunohost/certs/ + +cp -a $backup_dir/. /etc/yunohost/certs/ +service nginx reload +service metronome reload