Skip to content
Snippets Groups Projects
Commit e40ff091 authored by Levente Polyak's avatar Levente Polyak :rocket:
Browse files

Merge branch 'feature/borg-out-of-place-call' into 'master'

borg: allow out of place calls

See merge request !435
parents f7033ae2 d62f4096
No related branches found
No related tags found
1 merge request!435borg: allow out of place calls
Pipeline #10444 passed
...@@ -4,14 +4,15 @@ set -eu ...@@ -4,14 +4,15 @@ set -eu
shopt -s extglob shopt -s extglob
OFFSITE_HOST=ch-s012.rsync.net OFFSITE_HOST=ch-s012.rsync.net
ROOT_DIR=$(dirname "${0}")/..
decrypted_gpg=$(mktemp) decrypted_gpg=$(mktemp arch-infrastructure-borg-XXXXXXXXX)
trap "rm \"${decrypted_gpg}\"" EXIT trap "rm -f \"${decrypted_gpg}\"" EXIT
[[ "$*" =~ $OFFSITE_HOST ]] && is_offsite=true || is_offsite=false [[ "$*" =~ $OFFSITE_HOST ]] && is_offsite=true || is_offsite=false
# Find matching key # Find matching key
matching_key="" matching_key=""
for gpgkey in borg-keys/!(*-offsite.gpg); do for gpgkey in "$ROOT_DIR"/borg-keys/!(*-offsite.gpg); do
key=$(basename "$gpgkey" .gpg) key=$(basename "$gpgkey" .gpg)
if [[ "$*" =~ $key ]]; then if [[ "$*" =~ $key ]]; then
matching_key="$key" matching_key="$key"
...@@ -25,7 +26,7 @@ if [[ -z "$matching_key" ]]; then ...@@ -25,7 +26,7 @@ if [[ -z "$matching_key" ]]; then
echo "No matching keyfile found for this host" echo "No matching keyfile found for this host"
exit 1 exit 1
fi fi
gpg --batch --yes --decrypt -aq --output "$decrypted_gpg" borg-keys/"$matching_key.gpg" gpg --batch --yes --decrypt -aq --output "$decrypted_gpg" "$ROOT_DIR/borg-keys/$matching_key.gpg"
BORG_KEY_FILE="$decrypted_gpg" borg "$@" BORG_KEY_FILE="$decrypted_gpg" borg "$@"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment