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
This commit is contained in:
Maniack Crudelis 2018-11-23 13:21:37 +01:00 committed by Alexandre Aubin
parent d9a18d75de
commit 6bfcedfe1d

View file

@ -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