Skip to content
Snippets Groups Projects
Commit 10b8887b authored by Guillaume Subiron's avatar Guillaume Subiron
Browse files

Merge branch 'borg_cache_dir_location' into 'master'

Borg cache dir location

See merge request riseuplabs/backupninja!29
parents edcdf9dc e28da8c3
No related branches found
No related tags found
No related merge requests found
...@@ -180,3 +180,9 @@ exclude = /var/lib/mysql ...@@ -180,3 +180,9 @@ exclude = /var/lib/mysql
## ##
## Default: ## Default:
# passphrase = # passphrase =
## Path to the directory that will hold borg's cache files. By default this is
## empty, which will let borg use its default path of "~/.cache/borg".
##
## Default:
# cache_directory =
...@@ -31,6 +31,7 @@ getconf create_options ...@@ -31,6 +31,7 @@ getconf create_options
getconf prune yes getconf prune yes
getconf keep 30d getconf keep 30d
getconf prune_options getconf prune_options
getconf cache_directory
setsection dest setsection dest
getconf user getconf user
...@@ -57,6 +58,20 @@ else ...@@ -57,6 +58,20 @@ else
fi fi
execstr_archive="$archive" execstr_archive="$archive"
if [ -n "$cache_directory" ]; then
cache_parent_dir=$(dirname "$(readlink -f "$cache_directory")")
[ -d "$cache_parent_dir" ] || fatal "Cache directory parent dir '$cache_parent_dir' is absent or is not a directory."
BORG_CACHE_DIR=$cache_directory
export BORG_CACHE_DIR
else
# Cache dir not set, let's clear out the environment variable to avoid
# having this directory be pointed to a random destination.
# Also apparently if we set the variable to an empty string, borg uses the
# empty string as though it was some path we specified and backup runs
# error out, so we need to unset the variable completely.
unset BORG_CACHE_DIR
fi
# check the connection at the source and destination # check the connection at the source and destination
[ -n "$test" ] || test=0 [ -n "$test" ] || test=0
if [ "$host" != "localhost" ] && ([ "$testconnect" = "yes" ] || [ "${test}" -eq 1 ]); then if [ "$host" != "localhost" ] && ([ "$testconnect" = "yes" ] || [ "${test}" -eq 1 ]); then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment