merge func backupFail with backupFiles

This commit is contained in:
Asif Bacchus 2019-05-20 17:11:33 -06:00
parent e5d19aa871
commit 1d473633b1

View File

@ -24,17 +24,12 @@ note="\e[95m"
function backupFiles {
# check if file exists
if [ -f "${F2B-DIR}/$1" ]; then
cp "${F2B-DIR}/$1" "${F2B-DIR}/$1.original"
return "$?"
fi
return 0
}
function backupFail {
if [ "$(cp "${F2B-DIR}/$1" "${F2B-DIR}/$1.original")" -ne 0 ]; then
echo
echo -e "${err}There was a problem backing up your current configuration."
echo -e "This suggests some kind of permissions error. Please remedy this" \
"and rerun"
echo -e "${err}There was a problem backing up your current" \
"configuration."
echo -e "This suggests some kind of permissions error. Please" \
"remedy this and rerun"
echo -e "this script."
echo
echo -e "${note}Error backing up file: ${lit}$1"
@ -42,7 +37,10 @@ function backupFail {
echo -e "${err}Exiting.${normal}"
echo
exit 100
fi
fi
}
### end of functions