git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit8985aca004193bd179ab49e49d2eff37d77a44a5 authorNicolas Benes <nbenes.gh@xandea.de> dateTue 28 Dec 2021, 17:01 (5 years ago) parent75d6b00
1 file changed+11−4
pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix+11−4
pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix+11−4
@@ -297,10 +297,17 @@ stdenv.mkDerivation rec {
297297 cp -u --no-preserve=mode,owner "$TBB_IN_STORE/TorBrowser/Data/Browser/profile.default/bookmarks.html" \
298298 "\$HOME/TorBrowser/Data/Browser/profile.default/bookmarks.html"
299299
300− # Clear out some files that tend to capture store references but are
301− # easily generated by firefox at startup.
302− rm -f "\$HOME/TorBrowser/Data/Browser/profile.default"/{addonStartup.json.lz4,compatibility.ini,extensions.ini,extensions.json}
303− rm -f "\$HOME/TorBrowser/Data/Browser/profile.default"/startupCache/*
300+ # Clear some files if the last known store path is different from the new one
301+ : "\''${KNOWN_STORE_PATH:=\$HOME/known-store-path}"
302+ if ! [ "\$KNOWN_STORE_PATH" -ef $out ]; then
303+ echo "Cleanup files with outdated store references"
304+ ln -Tsf $out "\$KNOWN_STORE_PATH"
305+
306+ # Clear out some files that tend to capture store references but are
307+ # easily generated by firefox at startup.
308+ rm -f "\$HOME/TorBrowser/Data/Browser/profile.default"/{addonStartup.json.lz4,compatibility.ini,extensions.ini,extensions.json}
309+ rm -f "\$HOME/TorBrowser/Data/Browser/profile.default"/startupCache/*
310+ fi
304311
305312 # XDG
306313 : "\''${XDG_RUNTIME_DIR:=/run/user/\$(id -u)}"