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.

25 lines
598 B

#!/usr/bin/env bash
set -e
source ~/.config/restic-backup/
cleanup() {
pass gocrypt close || true > /dev/null 2>&1
trap cleanup EXIT
pass gocrypt close > /dev/null 2>&1 || true
PASS_GOCRYPT_CLOSE_TIMEOUT=2147483648 pass gocrypt open
for dir in ${RESTIC_BACKUP_SUBVOL_PATHS[@]}; do
parent="$(dirname $dir)"
snap="$parent/$(basename $dir)-restic"
echo "snap = $snap"
sudo btrfs subvol delete "$snap" > /dev/null 2>&1 || true
sudo btrfs subvol snap "$dir" "$snap"
restic-wrapper --verbose backup --exclude-caches "$snap"
sudo btrfs subvol delete "$snap" || true