Useful-scripts/backupfirefox.sh
2025-02-20 15:21:10 +01:00

24 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
DATE=$(date --iso-8601=hours)
if [[ "$1" = "--restore" ]] then
FILENAME="/home/fire/Downloads/$DATE.tar.gz"
tar -czf $FILENAME -C /home/fire/.mozilla ./firefox
echo "backed up current firefox data to $FILENAME"
case $HOSTNAME in
(HentaiStash) RESTORE="/home/storage/storage/code/browser/firefox/"$(ls -t /home/storage/storage/code/browser/firefox/ | head -n1);;
(ArchLaptop) RESTORE="/home/fire/Nextcloud/storage/code/browser/firefox/"$(ls -t /home/fire/Nextcloud/storage/code/browser/firefox/ | head -n1);;
(*) echo "include device in script"; exit 1;;
esac
echo "restoring $RESTORE"
rm -rf /home/fire/.mozilla/firefox
tar -xzf $RESTORE -C /home/fire/.mozilla
else
case $HOSTNAME in
(HentaiStash) FILENAME="/home/storage/storage/code/browser/firefox/$DATE.tar.gz";;
(ArchLaptop) FILENAME="/home/fire/Nextcloud/storage/code/browser/firefox/$DATE.tar.gz";;
(*) echo "include device in script"; exit 1;;
esac
echo "backing up current firefox data"
tar -czf $FILENAME -C /home/fire/.mozilla ./firefox
fi