fix errant F2B-DIR var name and add debug output

This commit is contained in:
Asif Bacchus 2019-05-20 18:03:25 -06:00
parent 40a6d0cfb0
commit 7998bee50e

View File

@ -54,7 +54,8 @@ fi
### default values for variables ### default values for variables
F2B-DIR='/etc/fail2ban' F2B_DIR="$1"
echo "(testing: base-dir is: ${F2B_DIR})"
### user info preamble ### user info preamble
@ -81,28 +82,28 @@ echo
# note: prefixing cp with '\' to override any alias settings # note: prefixing cp with '\' to override any alias settings
# copy .local files # copy .local files
if [ "$(\cp --force --backup=simple --suffix=.original \ if [ "$(\cp --force --backup=simple --suffix=.original \
etc/fail2ban/*.local "${F2B-DIR}/")" -ne 0 ]; then etc/fail2ban/*.local "${F2B_DIR}/")" -ne 0 ]; then
copyFailure 'general config files (.local)' copyFailure 'general config files (.local)'
fi fi
echo -e "${info}Copy general configuration files${normal} -- ${ok}[OK]${normal}" echo -e "${info}Copy general configuration files${normal} -- ${ok}[OK]${normal}"
# copy action configuration files # copy action configuration files
if [ "$(\cp --force --backup=simple --suffix=.original \ if [ "$(\cp --force --backup=simple --suffix=.original \
etc/fail2ban/action.d/* "${F2B-DIR}/action.d/")" -ne 0 ]; then etc/fail2ban/action.d/* "${F2B_DIR}/action.d/")" -ne 0 ]; then
copyFailure 'action files' copyFailure 'action files'
fi fi
echo -e "${info}Copy action configuration files${normal} -- ${ok}[OK]${normal}" echo -e "${info}Copy action configuration files${normal} -- ${ok}[OK]${normal}"
# copy filter configuration files # copy filter configuration files
if [ "$(\cp --force --backup=simple --suffix=.original \ if [ "$(\cp --force --backup=simple --suffix=.original \
etc/fail2ban/filter.d/* "${F2B-DIR}/filter.d/")" -ne 0 ]; then etc/fail2ban/filter.d/* "${F2B_DIR}/filter.d/")" -ne 0 ]; then
copyFailure 'filter files' copyFailure 'filter files'
fi fi
echo -e "${info}Copy filter configuration files${normal} -- ${ok}[OK]${normal}" echo -e "${info}Copy filter configuration files${normal} -- ${ok}[OK]${normal}"
# copy jail configuration files # copy jail configuration files
if [ "$(\cp --force --backup=simple --suffix=.original \ if [ "$(\cp --force --backup=simple --suffix=.original \
etc/fail2ban/jail.d/* "${F2B-DIR}/jail.d/")" -ne 0 ]; then etc/fail2ban/jail.d/* "${F2B_DIR}/jail.d/")" -ne 0 ]; then
copyFailure 'jail files' copyFailure 'jail files'
fi fi
echo -e "${info}Copy jail configuration files${normal} -- ${ok}[OK]${normal}" echo -e "${info}Copy jail configuration files${normal} -- ${ok}[OK]${normal}"