humble-homelab/scripts/restic.sh

13 lines
456 B
Bash
Executable file

#!/bin/env bash
# Source: https://stackoverflow.com/a/4774063
PROJECT_ROOT="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/.."
# Helper script for calling Restic using correct repo and password.
VAULT=$(ansible-vault decrypt "$PROJECT_ROOT/group_vars/all/vault.yml" --output=-)
export RESTIC_REPOSITORY=$(echo "$VAULT" | grep restic_url | awk '{print $2}')
export RESTIC_PASSWORD=$(echo "$VAULT" | grep restic_pw | awk '{print $2}')
restic "$@"