You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/roles/common/templates/backup_files.sh

20 lines
525 B
Bash

#!/usr/bin/env bash
set -euxo pipefail;
# Arguments
path="$1";
target="$2";
# Variables
dir="$(dirname "$path")";
base="$(basename "$path")";
dest="$target/latest.tar.gpg";
# Execution
tar --directory="$dir" --create --dereference --file=- "$base" |
pv --quiet --buffer-size 256M |
gpg --quiet --no-verbose --compress-level 0 --encrypt --recipient {{ backup_gpg_fingerprint | quote }} --trust-model always > "$dest";
chmod u+r-wx,g+r-wx,o+r-wx "$dest";
{{ global_helper_directory | quote }}/backup_rename.sh "$dest";