syntax and var name corrections

This commit is contained in:
Asif Bacchus 2019-05-27 06:10:06 -06:00
parent 090ce7d7fb
commit f33f4824fa

View File

@ -12,7 +12,7 @@ warn=$(tput bold)$(tput setaf 3)
ok=$(tput setaf 2) ok=$(tput setaf 2)
yellow=$(tput setaf 3) yellow=$(tput setaf 3)
cyan=$(tput setaf 6) cyan=$(tput setaf 6)
mag=$(tput setaf 5) magenta=$(tput setaf 5)
### functions ### functions
@ -330,7 +330,7 @@ fi
### start logging ### start logging
printf "${mag}[%s] --- Start %s execution ---${norm}\n" \ printf "${magenta}[%s] --- Start %s execution ---${norm}\n" \
"$(stamp)" "$scriptName" >> "$logFile" "$(stamp)" "$scriptName" >> "$logFile"
printf "${cyan}[%s] -- [INFO] Log located at ${yellow}%s${cyan} --${norm}\n" \ printf "${cyan}[%s] -- [INFO] Log located at ${yellow}%s${cyan} --${norm}\n" \
"$(stamp)" "$logFile" >> "$logFile" "$(stamp)" "$logFile" >> "$logFile"
@ -432,7 +432,7 @@ elif [ ! -d "${borgBaseDir}" ]; then
badDetails dne 'borgBaseDir' badDetails dne 'borgBaseDir'
fi fi
printf "${magenta}details:borgBaseDir ${norm}-- ${ok}[OK]${norm}\n" \ printf "${magenta}details:borgBaseDir ${norm}-- ${ok}[OK]${norm}\n" \
>> "$logfile" >> "$logFile"
export BORG_BASE_DIR="${borgBaseDir%/}" export BORG_BASE_DIR="${borgBaseDir%/}"
## check path to SSH keyfile ## check path to SSH keyfile
@ -442,7 +442,7 @@ elif [ ! -d "${borgSSHKey}" ]; then
badDetails dne 'borgSSHKey' badDetails dne 'borgSSHKey'
fi fi
printf "${magenta}details:borgSSHKey ${norm}-- ${ok}[OK]${norm}\n" \ printf "${magenta}details:borgSSHKey ${norm}-- ${ok}[OK]${norm}\n" \
>> "$logfile" >> "$logFile"
export BORG_RSH="ssh -i ${borgSSHKey}" export BORG_RSH="ssh -i ${borgSSHKey}"
## check borg repo connect string ## check borg repo connect string
@ -450,13 +450,13 @@ if [ -z "${borgConnectRepo}" ]; then
badDetails empty 'borgConnectRepo' badDetails empty 'borgConnectRepo'
fi fi
printf "${magenta}details:borgConnectRepo ${norm}-- ${ok}[OK]${norm}\n" \ printf "${magenta}details:borgConnectRepo ${norm}-- ${ok}[OK]${norm}\n" \
>> "$logfile" >> "$logFile"
export BORG_REPO="${borgConnectRepo}" export BORG_REPO="${borgConnectRepo}"
## check borg repo password ## check borg repo password
if [ -n "${borgRepoPassphrase}" ]; then if [ -n "${borgRepoPassphrase}" ]; then
printf "${magenta}details:borgRepoPassphrase ${norm}-- ${ok}[OK]${norm}\n" \ printf "${magenta}details:borgRepoPassphrase ${norm}-- ${ok}[OK]${norm}\n" \
>> "$logfile" >> "$logFile"
export BORG_PASSPHRASE="${borgRepoPassphrase}" export BORG_PASSPHRASE="${borgRepoPassphrase}"
else else
# if passwd is blank intentionally, this is insecure # if passwd is blank intentionally, this is insecure
@ -489,7 +489,7 @@ if [ -n "${borgXtraListPath}" ]; then
$( sed -e '/^\s*#.*$/d' -e '/^\s*$/d' "${borgXtraListPath}" ) $( sed -e '/^\s*#.*$/d' -e '/^\s*$/d' "${borgXtraListPath}" )
EOF EOF
printf "${magenta}details:borgXtraListPath ${norm}-- ${ok}[OK]${norm}\n" \ printf "${magenta}details:borgXtraListPath ${norm}-- ${ok}[OK]${norm}\n" \
>> "$logfile" >> "$logFile"
includeXtra=1 includeXtra=1
fi fi
@ -578,7 +578,7 @@ fi
if [ -n "${borgPruneSettings}" ]; then if [ -n "${borgPruneSettings}" ]; then
printf "${cyan}[%s] -- [INFO] Executing borg prune operation --${norm}\n" \ printf "${cyan}[%s] -- [INFO] Executing borg prune operation --${norm}\n" \
"$(stamp)" >> "$logFile" "$(stamp)" >> "$logFile"
borg prune --show-rc -v ${borgPruneParams} ${borgPruneSettings} \ borg prune --show-rc -v "${borgPruneParams}" "${borgPruneSettings}" \
2>> "$logFile" 2>> "$logFile"
borgPruneResult="$?" borgPruneResult="$?"
else else
@ -625,7 +625,7 @@ cleanup
# note complete success, tally warnings and exit # note complete success, tally warnings and exit
printf "${ok}[%s] -- [SUCCESS] All processes completed --${norm}\n" \ printf "${ok}[%s] -- [SUCCESS] All processes completed --${norm}\n" \
"$(stamp)" >> "$logFile" "$(stamp)" >> "$logFile"
printf "${mag}[%s] --- %s execution completed ---${norm}\n" \ printf "${magenta}[%s] --- %s execution completed ---${norm}\n" \
"$(stamp)" "$scriptName" >> "$logFile" "$(stamp)" "$scriptName" >> "$logFile"
if [ "$warnCount" -gt 0 ]; then if [ "$warnCount" -gt 0 ]; then
printf "${warn}%s warnings issued!${norm}\n" "${warnCount}" >> "$logFile" printf "${warn}%s warnings issued!${norm}\n" "${warnCount}" >> "$logFile"