scripts/backuper

20 lines
591 B
Bash
Executable File

#!/bin/env bash
copy () {
while read -r Line; do
echo "Syncing $(basename "$Line")"
rsync -ahAX -v --delete "$Line" "$HOME"/.local/backup
done <<< "$(cat "$HOME"/.config/rsync/sync-list)"
}
encrypt () {
x=$(date +%d.%m.%y)
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"
}
[ -z "$*" ] && exit 1
[ "$1" = "copy" ] && copy && exit 0
[ "$1" = "encrypt" ] && encrypt && exit 0