firefox backup script
This commit is contained in:
parent
5b16582597
commit
e0015b5dc7
@ -22,3 +22,8 @@ convert infile.md in the current folder to a pdf file (outfile.pdf) with code bl
|
|||||||
### flatten.sh
|
### flatten.sh
|
||||||
move all the files in $1 subdirectories to $1.
|
move all the files in $1 subdirectories to $1.
|
||||||
**Careful**, this operation is irreversible and manually moving back all the files to where they were supposed to be will be a pain if you flatten your home folder.
|
**Careful**, this operation is irreversible and manually moving back all the files to where they were supposed to be will be a pain if you flatten your home folder.
|
||||||
|
|
||||||
|
### backupfirefox.sh
|
||||||
|
script to backup firefox config directory and restore the latest backup
|
||||||
|
adapt the hostnames and paths to what you need, not made to be easily configured with environment variables.
|
||||||
|
**Careful**, firefox config folder includes all your profiles, including their cookies and localstorage (access tokens of your accounts can be there).
|
||||||
|
23
backupfirefox.sh
Executable file
23
backupfirefox.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/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
|
Loading…
x
Reference in New Issue
Block a user