3
0
Fork 0
forked from mirrors/nixpkgs

tor-browser-bundle-bin: Keep files when store path has not changed

Originally, some TBB files in the user's $HOME are always deleted on
startup, and as a result, addons are not loaded automatically at
startup. For example, NoScript is disabled by default and needs a manual
reload cycle (dis-/enable by hand).

This change preserves the files with the addon information as long as
the contained store path is the same, i.e. TBB was not modified.  When
TBB is updated, the files are removed as before, so that they don't
contain paths to the store location of the (now outdated) previous TBB.
A manual reload addon cycle is necessary once.
This commit is contained in:
Nicolas Benes 2021-12-28 17:01:11 +01:00
parent 75d6b0080f
commit 8985aca004

View file

@ -297,10 +297,17 @@ stdenv.mkDerivation rec {
cp -u --no-preserve=mode,owner "$TBB_IN_STORE/TorBrowser/Data/Browser/profile.default/bookmarks.html" \
"\$HOME/TorBrowser/Data/Browser/profile.default/bookmarks.html"
# Clear out some files that tend to capture store references but are
# easily generated by firefox at startup.
rm -f "\$HOME/TorBrowser/Data/Browser/profile.default"/{addonStartup.json.lz4,compatibility.ini,extensions.ini,extensions.json}
rm -f "\$HOME/TorBrowser/Data/Browser/profile.default"/startupCache/*
# Clear some files if the last known store path is different from the new one
: "\''${KNOWN_STORE_PATH:=\$HOME/known-store-path}"
if ! [ "\$KNOWN_STORE_PATH" -ef $out ]; then
echo "Cleanup files with outdated store references"
ln -Tsf $out "\$KNOWN_STORE_PATH"
# Clear out some files that tend to capture store references but are
# easily generated by firefox at startup.
rm -f "\$HOME/TorBrowser/Data/Browser/profile.default"/{addonStartup.json.lz4,compatibility.ini,extensions.ini,extensions.json}
rm -f "\$HOME/TorBrowser/Data/Browser/profile.default"/startupCache/*
fi
# XDG
: "\''${XDG_RUNTIME_DIR:=/run/user/\$(id -u)}"