Compare commits
No commits in common. "2b66d9e118ff804c639255e73323ee1f3a5fb258" and "55dc9fac0436467cf74e174bf4184c42a2cdf3d0" have entirely different histories.
2b66d9e118
...
55dc9fac04
@ -17,15 +17,6 @@ mag=$(tput setaf 5)
|
|||||||
|
|
||||||
### functions
|
### functions
|
||||||
|
|
||||||
# bad configuration value passed in details file
|
|
||||||
badDetails () {
|
|
||||||
if [ "$1" = "empty" ]; then
|
|
||||||
exitError 130 "details:${2} cannot be NULL (undefined)"
|
|
||||||
elif [ "$1" = "dne" ]; then
|
|
||||||
exitError 131 "details:${2} file or directory does not exist."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# bad parameter passed to script
|
# bad parameter passed to script
|
||||||
badParam () {
|
badParam () {
|
||||||
if [ "$1" = "dne" ]; then
|
if [ "$1" = "dne" ]; then
|
||||||
@ -137,8 +128,6 @@ borgPruneParams='--list'
|
|||||||
configDetails="$scriptPath/seafbackup.details"
|
configDetails="$scriptPath/seafbackup.details"
|
||||||
err503Copied=0
|
err503Copied=0
|
||||||
sqlCopied=0
|
sqlCopied=0
|
||||||
includeXtra=0
|
|
||||||
exclusions=0
|
|
||||||
|
|
||||||
# 503 related
|
# 503 related
|
||||||
use503=0
|
use503=0
|
||||||
@ -412,90 +401,6 @@ printf "${ok}[%s] -- [SUCCESS] SQL databases dumped successfully --${norm}\n" \
|
|||||||
"$(stamp)" >> "$logFile"
|
"$(stamp)" >> "$logFile"
|
||||||
|
|
||||||
|
|
||||||
### pre-backup tasks completed -- move to borg tasks
|
|
||||||
printf "${cyan}[%s] -- [INFO] Pre-backup tasks completed --${norm}\n" \
|
|
||||||
"$(stamp)" >> "$logFile"
|
|
||||||
|
|
||||||
|
|
||||||
### Run borg variable checks
|
|
||||||
printf "${cyan}[%s] -- [INFO] Verifying supplied borg details --${norm}\n" \
|
|
||||||
"$(stamp)" >> "$logFile"
|
|
||||||
|
|
||||||
## verify borg base directory
|
|
||||||
if [ -z "${borgBaseDir}" ]; then
|
|
||||||
badDetails empty 'borgBaseDir'
|
|
||||||
elif [ ! -d "${borgBaseDir}" ]; then
|
|
||||||
badDetails dne 'borgBaseDir'
|
|
||||||
fi
|
|
||||||
printf "${magenta}details:borgBaseDir ${norm}-- ${ok}[OK]${norm}\n" \
|
|
||||||
>> "$logfile"
|
|
||||||
export BORG_BASE_DIR="${borgBaseDir%/}"
|
|
||||||
|
|
||||||
## check path to SSH keyfile
|
|
||||||
if [ -z "${borgSSHKey}" ]; then
|
|
||||||
badDetails empty 'borgSSHKey'
|
|
||||||
elif [ ! -d "${borgSSHKey}" ]; then
|
|
||||||
badDetails dne 'borgSSHKey'
|
|
||||||
fi
|
|
||||||
printf "${magenta}details:borgSSHKey ${norm}-- ${ok}[OK]${norm}\n" \
|
|
||||||
>> "$logfile"
|
|
||||||
export BORG_RSH="ssh -i ${borgSSHKey}"
|
|
||||||
|
|
||||||
## check borg repo connect string
|
|
||||||
if [ -z "${borgConnectRepo}" ]; then
|
|
||||||
badDetails empty 'borgConnectRepo'
|
|
||||||
fi
|
|
||||||
printf "${magenta}details:borgConnectRepo ${norm}-- ${ok}[OK]${norm}\n" \
|
|
||||||
>> "$logfile"
|
|
||||||
export BORG_REPO="${borgConnectRepo}"
|
|
||||||
|
|
||||||
## check borg repo password
|
|
||||||
if [ -n "${borgRepoPassphrase}" ]; then
|
|
||||||
printf "${magenta}details:borgRepoPassphrase ${norm}-- ${ok}[OK]${norm}\n" \
|
|
||||||
>> "$logfile"
|
|
||||||
export BORG_PASSPHRASE="${borgRepoPassphrase}"
|
|
||||||
else
|
|
||||||
# if passwd is blank intentionally, this is insecure
|
|
||||||
printf "${warn} -- [WARNING] Using a borg repo without a password is an " \
|
|
||||||
>> "$logFile"
|
|
||||||
printf "insecure configuration --${norm}\n" >> "$logFile"
|
|
||||||
# if this was an accident, we need to provide a bogus passwd so borg fails
|
|
||||||
# otherwise it will sit forever just waiting for input
|
|
||||||
export BORG_PASSPHRASE="DummyPasswordSoBorgFails"
|
|
||||||
fi
|
|
||||||
|
|
||||||
## read additional files
|
|
||||||
if [ -n "${borgXtraListPath}" ]; then
|
|
||||||
# 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 "${magenta}details:borgXtraListPath ${norm}-- ${ok}[OK]${norm}\n" \
|
|
||||||
>> "$logfile"
|
|
||||||
includeXtra=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
## check if exlusion list file is specified
|
|
||||||
if [ -n "${borgExcludeListPath}" ]; then
|
|
||||||
# check if the file actually exists
|
|
||||||
if [ ! -f "${borgExcludeListPath}" ]; then
|
|
||||||
badDetails dne 'borgExcludeListPath'
|
|
||||||
fi
|
|
||||||
exclusions=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -512,6 +417,4 @@ exit 0
|
|||||||
# 111: could not create tmp dir for SQL dump files
|
# 111: could not create tmp dir for SQL dump files
|
||||||
# 115: could not dump CCNET-DB
|
# 115: could not dump CCNET-DB
|
||||||
# 116: could not dump SEAFILE-DB
|
# 116: could not dump SEAFILE-DB
|
||||||
# 117: could not dump SEAHUB-DB
|
# 117: could not dump SEAHUB-DB
|
||||||
# 130: null borg configuration variable
|
|
||||||
# 131: invalid borg configuration variable
|
|
Loading…
Reference in New Issue
Block a user