make xtraList optional

This commit is contained in:
Asif Bacchus 2020-05-07 04:58:26 -06:00
parent f57841b69a
commit 8486c4b7d2
1 changed files with 22 additions and 22 deletions

View File

@ -469,28 +469,6 @@ printf "%s[%s] -- [INFO] %s%s%s imported --%s\n" \
printf "%s[%s] -- [INFO] Verifying supplied borg details --%s\n" \
"$cyan" "$(stamp)" "$norm" >> "$logFile"
## read additional files -- this is required otherwise nothing to backup!
if [ -z "${borgXtraListPath}" ]; then
badDetails empty 'xtraLocations'
else
# check if file actually exists
if [ ! -f "${borgXtraListPath}" ]; then
badDetails dne 'borgXtraListPath'
fi
# read file contents into concatenated list for echo to cmdline
while read -r xtraItem; do
if [ -z "${xtraList}" ]; then
xtraList="${xtraItem}"
else
xtraList="${xtraList} ${xtraItem}"
fi
done <<EOF
$( sed -e '/^\s*#.*$/d' -e '/^\s*$/d' "${borgXtraListPath}" )
EOF
printf "%sdetails:borgXtraListPath %s-- %s[OK]%s\n" \
"$magenta" "$norm" "$ok" "$norm" >> "$logFile"
fi
## verify borg base directory
if [ -z "${borgBaseDir}" ]; then
badDetails empty 'borgBaseDir'
@ -559,6 +537,28 @@ if [ -n "${borgExcludeListPath}" ]; then
exclusions=1
fi
## read additional files
if [ -z "${borgXtraListPath}" ]; then
xtraList=''
else
# check if file actually exists
if [ ! -f "${borgXtraListPath}" ]; then
badDetails dne 'borgXtraListPath'
fi
# read file contents into concatenated list for echo to cmdline
while read -r xtraItem; do
if [ -z "${xtraList}" ]; then
xtraList="${xtraItem}"
else
xtraList="${xtraList} ${xtraItem}"
fi
done <<EOF
$( sed -e '/^\s*#.*$/d' -e '/^\s*$/d' "${borgXtraListPath}" )
EOF
printf "%sdetails:borgXtraListPath %s-- %s[OK]%s\n" \
"$magenta" "$norm" "$ok" "$norm" >> "$logFile"
fi
### set location of sql dump
# this is done before resetting default TMP dir for borg