FollieHiyuki-dotfiles/home/.local/bin/firefox-sync
2021-10-17 21:48:10 +07:00

30 lines
547 B
Bash
Executable File

#!/bin/sh
# A modified version compared to the one from the Arch Wiki
# (intended for using with Flatpak Firefox)
static=static-$1
link=$1
volatile=/dev/shm/firefox-$1-$USER
IFS=
set -efu
cd ~/.var/app/org.mozilla.firefox/.mozilla/firefox
if [ ! -r $volatile ]; then
mkdir -m0700 $volatile
fi
if [ "$(readlink $link)" != "$volatile" ]; then
mv $link $static
ln -s $volatile $link
fi
if [ -e $link/.unpacked ]; then
rsync -av --delete --exclude .unpacked ./$link/ ./$static/
else
rsync -av ./$static/ ./$link/
touch $link/.unpacked
fi