Update backuping script.
This commit is contained in:
parent
771d23fe76
commit
6a9a9dd8d4
22
backuper
22
backuper
@ -1,21 +1,19 @@
|
|||||||
#!/bin/env bash
|
#!/bin/env bash
|
||||||
|
|
||||||
copy () {
|
copy () {
|
||||||
while read Line; do
|
while read -r Line; do
|
||||||
echo "Syncing $(basename $Line)"
|
echo "Syncing $(basename "$Line")"
|
||||||
rsync -ahAX -v --delete "$Line" $HOME/.local/backup
|
rsync -ahAX -v --delete "$Line" "$HOME"/.local/backup
|
||||||
done <<< "$(cat $HOME/.config/rsync/sync-list)"
|
done <<< "$(cat "$HOME"/.config/rsync/sync-list)"
|
||||||
}
|
}
|
||||||
|
|
||||||
encrypt () {
|
encrypt () {
|
||||||
x=$(date +%d.%m.%y)
|
x=$(date +%d.%m.%y)
|
||||||
cd "$HOME/.local"
|
cd "$HOME/.local" || exit 1
|
||||||
tar cv -I"zstd -19 -T0" -f "$HOME/.local/cloud/backup-$x.tar.zst" "backup"
|
[ ! -d "$HOME/.local/cloud" ] || mkdir -p "$HOME/.local/cloud"
|
||||||
read -p "Enter public key" pubKey
|
tar cv -I"zstd -19 -T0" "backup" | age -r "age1chj26ez7ucr2smkr8sfc9ddaa0fcyfljh5f5uk5kuyd8ctahs9wslfs708" > "$HOME/.local/cloud/backup-$x.tar.zst.age"
|
||||||
age -r $pubKey "$HOME/.local/cloud/backup-$x.tar.zst" > "$HOME/.local/cloud/backup-$x.tar.zst.age"
|
|
||||||
shred -uzn3 "$HOME/.local/cloud/backup-$x.tar.zst"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -z "$@" ] && exit 1
|
[ -z "$*" ] && exit 1
|
||||||
[ "$1" = "copy" ] && copy
|
[ "$1" = "copy" ] && copy && exit 0
|
||||||
[ "$1" = "encrypt" ] && encrypt
|
[ "$1" = "encrypt" ] && encrypt && exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user