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