Every time after updating Firefox module it created new clean profile, so far I marked old profile as default in "about:profiles". Over time, it was getting more and more annoying

During my fast research I found this post:
https://support.mozilla.org/en-US/questions/1418760#answer-1591862 wrote:
Issue depends exactly to the "path" in which is installed firefox binary file.
The script I used creates a package that installs it within a path containing version number of firefox:
```
/usr/lib64/firefox-115.0.2/firefox
/usr/lib64/firefox-115.0.2/firefox-bin
```
The hash as you pointed out is generated by that path.
When I upgrade that path changes, hash changes and the new firefox create a new profile linked to the new hash (and differs by the old default profile).
By reading latest-firefox.sh gist they have patched this issue, now the path contains the firefox "channel" (latest, esr, beta...). So the path should become something like:
/usr/lib64/firefox-latest/firefox
And it remains the same as far as upgrades belong to the same "channel".
If I try to upgrade to a "beta" version that path will change (/usr/lib64/firefox-beta/firefox) and a new profile will be created when FF will be restarted. I think it's a proper solution.
I made the patch of "update-firefox-live" script which changes that where firefox executables are placed in module (before was /usr/lib64/firefox-VERSION_NUMBER):
- /usr/lib64/firefox-esr for esr
- /usr/lib64/firefox-current for current
- /usr/lib64/firefox-beta for beta
Code: Select all
--- update-firefox-live 2024-05-08 18:38:07.792006582 +0200
+++ update-firefox-live.new 2024-05-08 18:46:03.700482871 +0200
@@ -218,13 +218,13 @@
dWNrRHVja0dvIgpicm93c2VyLmNhY2hlLmRpc2suY2FwYWNpdHk9MTAyNDAKYnJvd3Nlci5zaGVs
bC5jaGVja0RlZmF1bHRCcm93c2VyPWZhbHNlCmFwcC5zaGllbGQub3B0b3V0c3R1ZGllcy5lbmFi
bGVkPWZhbHNlCmJyb3dzZXIuY29tcGFjdG1vZGUuc2hvdz10cnVlCmJyb3dzZXIudGFicy5pblRp
-dGxlYmFyPTAK" | base64 -d > $TARG/usr/lib${SUFFIX}/firefox-$LATVER/distribution/distribution.ini
+dGxlYmFyPTAK" | base64 -d > $TARG/usr/lib${SUFFIX}/firefox-$CHOICE1/distribution/distribution.ini
}
disable_updates(){
echo "ewoicG9saWNpZXMiOiAKICAgewogICAgICJEaXNhYmxlQXBwVXBkYXRlIjogdHJ1ZSwKICAgICAi
RGlzYWJsZVRlbGVtZXRyeSI6IHRydWUsCiAgICAgIkRpc2FibGVQb2NrZXQiOiB0cnVlCiAgICB9
-Cn0K" | base64 -d > $TARG/usr/lib${SUFFIX}/firefox-$LATVER/distribution/policies.json
+Cn0K" | base64 -d > $TARG/usr/lib${SUFFIX}/firefox-$CHOICE1/distribution/policies.json
}
create_fake_slack(){
@@ -427,7 +427,7 @@
fi
## Create distribution directory
-mkdir -p $TARG/usr/lib${SUFFIX}/firefox-$LATVER/distribution || \
+mkdir -p $TARG/usr/lib${SUFFIX}/firefox-$CHOICE1/distribution || \
{ red "Failed to create distibution directory."; cleanup; exit 1; }
green "Decompressing firefox tarball ..."
@@ -437,18 +437,18 @@
green "Linking firefox binary ..."
cd $TARG/usr/lib${SUFFIX}
-ln -sf ./firefox-$LATVER firefox
+ln -sf ./firefox-$CHOICE1 firefox
cd -
## Create lib dir
green "Copying firefox files ..."
-cp -a firefox/* $TARG/usr/lib${SUFFIX}/firefox-$LATVER/ #|| { red "Failed to copy firefox directory."; cleanup; exit 1; }
+cp -a firefox/* $TARG/usr/lib${SUFFIX}/firefox-$CHOICE1/ #|| { red "Failed to copy firefox directory."; cleanup; exit 1; }
[ -e $TARG/usr/bin/firefox ] && unlink $TARG/usr/bin/firefox
[ ! -d $TARG/usr/bin ] && mkdir -p $TARG/usr/bin
-#ln -s /usr/lib${SUFFIX}/firefox-$LATVER/firefox $TARG/usr/bin/firefox
+#ln -s /usr/lib${SUFFIX}/firefox-$CHOICE1/firefox $TARG/usr/bin/firefox
cat > $TARG/usr/bin/firefox << EOF
#!/bin/bash
-exec env GTK_CSD=1 /usr/lib${SUFFIX}/firefox-$LATVER/firefox "\$@"
+exec env GTK_CSD=1 /usr/lib${SUFFIX}/firefox-$CHOICE1/firefox "\$@"
EOF
chmod +x $TARG/usr/bin/firefox
@@ -467,8 +467,8 @@
#chown -R 1000:1000 $TARG/home/guest
chmod 755 $TARG/usr/bin
chmod 755 $TARG/usr/lib${SUFFIX}
-chmod 755 $TARG/usr/lib${SUFFIX}/firefox-$LATVER
-chmod -R 755 $TARG/usr/lib${SUFFIX}/firefox-$LATVER/distribution
+chmod 755 $TARG/usr/lib${SUFFIX}/firefox-$CHOICE1
+chmod -R 755 $TARG/usr/lib${SUFFIX}/firefox-$CHOICE1/distribution
mkdir -p $TARG/usr/share/applications 2>/dev/null
echo "W0Rlc2t0b3AgRW50cnldCkV4ZWM9ZmlyZWZveCAldQpJY29uPWZpcmVmb3gKVHlwZT1BcHBsaWNh
@@ -528,7 +528,7 @@
# Add home page
green "Adding home page: $HOMEPAGE"
-sed -i 's@https://forum.porteus.org@'$HOMEPAGE'@g' $TARG/usr/lib${SUFFIX}/firefox-$LATVER/distribution/distribution.ini
+sed -i 's@https://forum.porteus.org@'$HOMEPAGE'@g' $TARG/usr/lib${SUFFIX}/firefox-$CHOICE1/distribution/distribution.ini
create_fake_slack
## remove - for some locales
Of course Firefox from module created by patched script will again create new profile (I hope it will be last time

), but after next updates old selected profile should be loaded

And no, symlink (firefox -> firefox-125.0.3) won't help because it's somehow dereferenced by firefox executable.