diff --git a/hooks/backup/05-conf_ldap b/hooks/backup/05-conf_ldap
index ea1a5e2257..4980ec4194 100644
--- a/hooks/backup/05-conf_ldap
+++ b/hooks/backup/05-conf_ldap
@@ -19,9 +19,11 @@
#
# Exit hook on subcommand error or unset variable
-set -eu
+set -Eeuo pipefail
+
# Source YNH helpers
+# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers
# Backup destination
diff --git a/hooks/backup/17-data_home b/hooks/backup/17-data_home
index b537d4e82a..465db0384d 100644
--- a/hooks/backup/17-data_home
+++ b/hooks/backup/17-data_home
@@ -19,9 +19,10 @@
#
# Exit hook on subcommand error or unset variable
-set -eu
+set -Eeuo pipefail
# Source YNH helpers
+# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers
# Backup destination
diff --git a/hooks/backup/18-data_multimedia b/hooks/backup/18-data_multimedia
index 98529ec118..2190023979 100644
--- a/hooks/backup/18-data_multimedia
+++ b/hooks/backup/18-data_multimedia
@@ -19,9 +19,10 @@
#
# Exit hook on subcommand error or unset variable
-set -eu
+set -Eeuo pipefail
# Source YNH helpers
+# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers
# Backup destination
diff --git a/hooks/backup/20-conf_ynh_settings b/hooks/backup/20-conf_ynh_settings
index 9793c41f23..e9b6a41995 100644
--- a/hooks/backup/20-conf_ynh_settings
+++ b/hooks/backup/20-conf_ynh_settings
@@ -19,9 +19,10 @@
#
# Exit hook on subcommand error or unset variable
-set -eu
+set -Eeuo pipefail
# Source YNH helpers
+# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers
# Backup destination
diff --git a/hooks/backup/21-conf_ynh_certs b/hooks/backup/21-conf_ynh_certs
index be910202f0..75b45e67cc 100644
--- a/hooks/backup/21-conf_ynh_certs
+++ b/hooks/backup/21-conf_ynh_certs
@@ -19,9 +19,10 @@
#
# Exit hook on subcommand error or unset variable
-set -eu
+set -Eeuo pipefail
# Source YNH helpers
+# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers
# Backup destination
diff --git a/hooks/backup/23-data_mail b/hooks/backup/23-data_mail
index 8a2ff231bb..9f0254aa1c 100644
--- a/hooks/backup/23-data_mail
+++ b/hooks/backup/23-data_mail
@@ -19,9 +19,10 @@
#
# Exit hook on subcommand error or unset variable
-set -eu
+set -Eeuo pipefail
# Source YNH helpers
+# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers
# Backup destination
diff --git a/hooks/backup/50-conf_manually_modified_files b/hooks/backup/50-conf_manually_modified_files
index 7ee46acc15..439b6e2a63 100644
--- a/hooks/backup/50-conf_manually_modified_files
+++ b/hooks/backup/50-conf_manually_modified_files
@@ -18,7 +18,12 @@
# along with this program. If not, see .
#
+set -Eeuo pipefail
+
+# Source YNH helpers
+# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers
+
ynh_abort_if_errors
YNH_CWD="${YNH_BACKUP_DIR%/}/conf/manually_modified_files"
mkdir -p "$YNH_CWD"
diff --git a/hooks/restore/17-data_home b/hooks/restore/17-data_home
index eee53be4f0..09e101444b 100644
--- a/hooks/restore/17-data_home
+++ b/hooks/restore/17-data_home
@@ -20,4 +20,4 @@
backup_dir="$1/data/home"
-cp -a $backup_dir/. /home
+cp -a "$backup_dir/." /home
diff --git a/hooks/restore/18-data_multimedia b/hooks/restore/18-data_multimedia
index 799ddbbff9..af144ecb14 100644
--- a/hooks/restore/18-data_multimedia
+++ b/hooks/restore/18-data_multimedia
@@ -22,6 +22,7 @@
set -eu
# Source YNH helpers
+# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers
backup_dir="data/multimedia"
diff --git a/hooks/restore/21-conf_ynh_certs b/hooks/restore/21-conf_ynh_certs
index 185977059f..8da37c9a7f 100644
--- a/hooks/restore/21-conf_ynh_certs
+++ b/hooks/restore/21-conf_ynh_certs
@@ -22,4 +22,4 @@ backup_dir="$1/conf/ynh/certs"
mkdir -p /etc/yunohost/certs/
-cp -a $backup_dir/. /etc/yunohost/certs/
+cp -a "$backup_dir/." /etc/yunohost/certs/
diff --git a/hooks/restore/23-data_mail b/hooks/restore/23-data_mail
index 901c2d5af7..0b6214cba6 100644
--- a/hooks/restore/23-data_mail
+++ b/hooks/restore/23-data_mail
@@ -20,5 +20,5 @@
backup_dir="$1/data/mail"
-cp -a $backup_dir/. /var/mail/ || echo 'No mail found'
+cp -a "$backup_dir/." /var/mail/ || echo 'No mail found'
chown -R vmail:mail /var/mail/
diff --git a/hooks/restore/50-conf_manually_modified_files b/hooks/restore/50-conf_manually_modified_files
index c58fc638f4..00d67ace3a 100644
--- a/hooks/restore/50-conf_manually_modified_files
+++ b/hooks/restore/50-conf_manually_modified_files
@@ -18,7 +18,10 @@
# along with this program. If not, see .
#
+# Source YNH helpers
+# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers
+
ynh_abort_if_errors
YNH_CWD="${YNH_BACKUP_DIR%/}/conf/manually_modified_files"
cd "$YNH_CWD"