From cba2d63889fa3ae640d213ab2c15f99d3d941967 Mon Sep 17 00:00:00 2001 From: TheMightyV Date: Tue, 4 Jan 2022 22:41:10 +0100 Subject: optional password protection of borg repo fixed borg backup check added nanoseconds to old world backup to prevent collision during tests --- backends/borg.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/borg.sh b/backends/borg.sh index 5d7b2c7..b8854a1 100644 --- a/backends/borg.sh +++ b/backends/borg.sh @@ -1,9 +1,17 @@ function borg_init() { + local encryption + if [ -z "$BACKUP_PASSCOMMAND" ] ; then + echo "borg: no password given, repository is not protected" + encryption="none" + else + encryption="repokey-blake2" + fi + export BORG_PASSCOMMAND="$BACKUP_PASSCOMMAND" for backup_dir in ${BACKUP_DIRS[*]} do # borg will check if repo exists - borg init --encryption=repokey-blake2 "$backup_dir" + borg init --encryption="$encryption" "$backup_dir" done } @@ -78,5 +86,7 @@ function borg_restore() { local dest="$3" export BORG_REPO="$remote" + cd "$dest" borg extract "${remote}::${snapshot}" + cd - > /dev/null } -- cgit v1.2.3