This repository has been archived on 2022-08-21. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/home/.local/bin/firefox-sync

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