summaryrefslogtreecommitdiff
path: root/.local/bin/backup
blob: 4921b71479f2ff6564c9ae32059994d24857ba63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh

dirs="$HOME/.librewolf $HOME/.config $HOME/.config/BraveSoftware $HOME/.ssh $HOME/.local/share/gnupg $HOME/.local/bin $HOME/.local/src $HOME/.local/share/calcurse $HOME/.config/retroarch $HOME/.local/share/citra-emu $HOME/.local/share/dolphin-emu $HOME/.local/share/cemu $HOME/.local/share/yuzu $HOME/.local/share/xemu $HOME/.local/share/PolyMC $HOME/.config/newsboat"

hostname="$(cat /etc/hostname)"
cache="$HOME/.cache/backup"
dest="/media/share/data_exports/linux_data/$hostname"

rm -vf "$cache/*.tgz"

if [ ! -d $dest ]; then
        echo "$dest does not exist! Exiting!"
        exit 1
fi

mkdir -v $dest

for dir in $dirs; do
        echo "Backing up $dir..."
        archive="$(basename $dir)"
        tar -czvpf $cache/${archive}.tgz $dir
        rsync -vthP --remove-source-files $HOME/.cache/backup/${archive}.tgz ${dest}
done

rsync -vthP --remove-source-files $HOME/.cache/backup/*.tgz ${dest}
rsync -vthP --remove-source-files $HOME/.cache/backup/.*.tgz ${dest}

echo "Done!"

exit 0