From b40c7aa2034b2296ed86b5e206777732ba9aff26 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 17 May 2024 20:39:09 -0300 Subject: Fix: borg: keyfile encryption --- templates/borg.sh.erb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/templates/borg.sh.erb b/templates/borg.sh.erb index f64cf4e..646a41c 100644 --- a/templates/borg.sh.erb +++ b/templates/borg.sh.erb @@ -131,11 +131,12 @@ if [ "<%= @encryption %>" == "keyfile" ] && [ ! -z "<%= @keyfile %>" ]; then if [ ! -z "$GPG_KEY" ] && [ ! -z "$GPG_PASS" ]; then info "Backing up the OpenPGP-encrypted repository key into the remote destination..." - echo $GPG_PASS | gpg --passphrase-fd 0 --armor --encrypt \ - --recipient $GPG_KEY --default-key \ + rm -f $BORG_KEY_FILE + + echo $GPG_PASS | gpg --armor --encrypt --passphrase-fd 0 \ + --recipient $GPG_KEY --default-key $GPG_KEY \ --output $BORG_KEY_FILE.asc \ - --yes \ - $GPG_KEY $BORG_KEY_FILE + $BORG_KEY_FILE gpg_exit=$? -- cgit v1.2.3