From 6bfcedfe1d30d1579dd093b983545017d971651d Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Fri, 23 Nov 2018 13:21:37 +0100 Subject: [PATCH] Do not fail on missing fail2ban config during the backup (#558) * Do not fail on missing file during the backup * Fix for allow to backup without a fail2ban config file * Tab -> space consistency --- data/helpers.d/filesystem | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/data/helpers.d/filesystem b/data/helpers.d/filesystem index c07de2ece..badc0e997 100644 --- a/data/helpers.d/filesystem +++ b/data/helpers.d/filesystem @@ -60,8 +60,16 @@ ynh_backup() { # ============================================================================== # Be sure the source path is not empty [[ -e "${SRC_PATH}" ]] || { - echo "Source path '${SRC_PATH}' does not exist" >&2 - return 1 + echo "!!! Source path '${SRC_PATH}' does not exist !!!" >&2 + + # This is a temporary fix for fail2ban config files missing after the migration to stretch. + if echo "${SRC_PATH}" | grep --quiet "/etc/fail2ban" + then + touch "${SRC_PATH}" + echo "The missing file will be replaced by a dummy one for the backup !!!" >&2 + else + return 1 + fi } # Transform the source path as an absolute path