Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions common/profile-sync-daemon.in
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@ suffix_needed() {
[[ -n "$check_suffix" ]]
}

infix_needed() {
browser=$1
[[ $browser == *"-in-snap" ]]
}

dup_check() {
# only for firefox, icecat, seamonkey, and palemoon
# the LAST directory in the profile MUST be unique
Expand Down Expand Up @@ -429,13 +434,17 @@ do_sync_for() {
DIR="$item"
BACKUP="$item-backup"
BACK_OVFS="$item-back-ovfs"
infix=
if infix_needed "$browser"; then
infix="../snap.${browser%-in-snap}/"
fi
suffix=
if suffix_needed "$browser"; then
suffix="-${item##*/}"
fi
TMP="$VOLATILE/$user-$browser$suffix"
UPPER="$VOLATILE/$user-$browser${suffix}-rw"
WORK="$VOLATILE/.$user-$browser${suffix}"
TMP="$VOLATILE/$infix$user-$browser$suffix"
UPPER="$VOLATILE/$infix$user-$browser${suffix}-rw"
WORK="$VOLATILE/$infix.$user-$browser${suffix}"
local REPORT

# make tmpfs container
Expand Down Expand Up @@ -554,13 +563,17 @@ do_unsync() {
DIR="$item"
BACKUP="$item-backup"
BACK_OVFS="$item-back-ovfs"
infix=
if infix_needed "$browser"; then
infix="../snap.${browser%-in-snap}/"
fi
suffix=
if suffix_needed "$browser"; then
suffix="-${item##*/}"
fi
TMP="$VOLATILE/$user-$browser$suffix"
UPPER="$VOLATILE/$user-$browser${suffix}-rw"
WORK="$VOLATILE/.$user-$browser${suffix}"
TMP="$VOLATILE/$infix$user-$browser$suffix"
UPPER="$VOLATILE/$infix$user-$browser${suffix}-rw"
WORK="$VOLATILE/$infix.$user-$browser${suffix}"
# check if user has browser profile
if [[ -h "$DIR" ]]; then
unlink "$DIR"
Expand Down Expand Up @@ -634,11 +647,15 @@ parse() {
for item in "${DIRArr[@]}"; do
DIR="$item"
BACKUP="$item-backup"
infix=
if infix_needed "$browser"; then
infix="../snap.${browser%-in-snap}/"
fi
suffix=
if suffix_needed "$browser"; then
suffix="-${item##*/}"
fi
UPPER="$VOLATILE/$user-$browser${suffix}-rw"
UPPER="$VOLATILE/$infix$user-$browser${suffix}-rw"
if [[ -d "$DIR" ]]; then
local CRASHArr=()
while IFS= read -d '' -r backup; do
Expand Down Expand Up @@ -668,7 +685,7 @@ parse() {
warn=
fi
echo -en " ${BLD}tmpfs dir:"
echo -e "$(tput cr)$(tput cuf 17) ${GRN}$VOLATILE/$user-$browser$suffix${NRM}"
echo -e "$(tput cr)$(tput cuf 17) ${GRN}$VOLATILE/$infix$user-$browser$suffix${NRM}"
echo -en " ${BLD}profile size:"
echo -e "$(tput cr)$(tput cuf 17) $psize${NRM}"
if [[ -f $PID_FILE ]]; then
Expand Down
2 changes: 2 additions & 0 deletions contrib/chromium-in-snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DIRArr[0]="$HOME/snap/chromium/common/chromium"
PSNAME="chromium"
17 changes: 17 additions & 0 deletions contrib/firefox-in-snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
if [[ -d "$HOME/snap/firefox/common/.mozilla/firefox" ]]; then
index=0
PSNAME="firefox"
while read -r profileItem; do
if [[ $(echo "$profileItem" | cut -c1) = "/" ]]; then
# path is not relative
DIRArr[$index]="$profileItem"
else
# we need to append the default path to give a
# fully qualified path
DIRArr[$index]="$HOME/snap/firefox/common/.mozilla/firefox/$profileItem"
fi
(( index=index+1 ))
done < <(grep '^[Pp]ath=' "$HOME/snap/firefox/common/.mozilla/firefox/profiles.ini" | sed 's/[Pp]ath=//')
fi

check_suffix=1