2023-01-03 17:16:39 +01:00
|
|
|
#!/bin/env bash
|
|
|
|
|
|
|
|
copy () {
|
|
|
|
while read Line; do
|
|
|
|
echo "Syncing $(basename $Line)"
|
|
|
|
rsync -ahAX -v --delete "$Line" $HOME/.local/backup
|
2023-01-05 20:05:57 +01:00
|
|
|
done <<< "$(cat $HOME/.config/rsync/sync-list)"
|
2023-01-03 17:16:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
encrypt () {
|
|
|
|
x=$(date +%d.%m.%y)
|
|
|
|
cd "$HOME/.local"
|
|
|
|
tar cv -I"zstd -19 -T0" -f "$HOME/.local/cloud/backup-$x.tar.zst" "backup"
|
2023-04-21 12:05:27 +02:00
|
|
|
read -p "Enter public key" pubKey
|
|
|
|
age -r $pubKey "$HOME/.local/cloud/backup-$x.tar.zst" > "$HOME/.local/cloud/backup-$x.tar.zst.age"
|
2023-01-03 17:16:39 +01:00
|
|
|
shred -uzn3 "$HOME/.local/cloud/backup-$x.tar.zst"
|
|
|
|
}
|
|
|
|
|
|
|
|
[ -z "$@" ] && exit 1
|
|
|
|
[ "$1" = "copy" ] && copy
|
|
|
|
[ "$1" = "encrypt" ] && encrypt
|