scripts/backuper

20 lines
591 B
Plaintext
Raw Normal View History

2023-01-03 17:16:39 +01:00
#!/bin/env bash
copy () {
2023-12-10 18:48:31 +01:00
while read -r Line; do
echo "Syncing $(basename "$Line")"
rsync -ahAX -v --delete "$Line" "$HOME"/.local/backup
done <<< "$(cat "$HOME"/.config/rsync/sync-list)"
2023-01-03 17:16:39 +01:00
}
encrypt () {
x=$(date +%d.%m.%y)
2023-12-10 18:48:31 +01:00
cd "$HOME/.local" || exit 1
[ ! -d "$HOME/.local/cloud" ] || mkdir -p "$HOME/.local/cloud"
tar cv -I"zstd -19 -T0" "backup" | age -r "age1chj26ez7ucr2smkr8sfc9ddaa0fcyfljh5f5uk5kuyd8ctahs9wslfs708" > "$HOME/.local/cloud/backup-$x.tar.zst.age"
2023-01-03 17:16:39 +01:00
}
2023-12-10 18:48:31 +01:00
[ -z "$*" ] && exit 1
[ "$1" = "copy" ] && copy && exit 0
[ "$1" = "encrypt" ] && encrypt && exit 0