Created
December 16, 2021 10:55
-
-
Save matyklug18/48d30e1bc482722beccdf3177043c634 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /nix/store/a54wrar1jym1d8yvlijq0l2gghmy8szz-bash-5.1-p12/bin/bash | |
set -o errexit -o nounset | |
PATH=/nix/store/l6f4z8mmcnnxba8w004xn28y0vr4gdkf-coreutils-9.0/bin | |
export LC_ALL=C | |
export LOCALE_ARCHIVE=/nix/store/imsdp94kfmdj2hwfgzh0pxxln3nhbm4c-glibc-locales-2.33-56/lib/locale/locale-archive | |
# Enter local state directory. | |
REAL_HOME=$HOME | |
TBB_HOME=${TBB_HOME:-$REAL_HOME/.local/share/tor-browser} | |
HOME=$TBB_HOME | |
mkdir -p "$HOME" | |
cd "$HOME" | |
# Initialize empty TBB local state directory hierarchy. We | |
# intentionally mirror the layout that TBB would see if executed from | |
# the unpacked bundle dir. | |
mkdir -p "$HOME/TorBrowser" "$HOME/TorBrowser/Data" | |
# Initialize the Tor data directory. | |
mkdir -p "$HOME/TorBrowser/Data/Tor" | |
# TBB will fail if ownership is too permissive | |
chmod 0700 "$HOME/TorBrowser/Data/Tor" | |
# Initialize the browser profile state. Note that the only data | |
# copied from the Store payload is the initial bookmark file, which is | |
# never updated once created. All other files under user's profile | |
# dir are generated by TBB. | |
mkdir -p "$HOME/TorBrowser/Data/Browser/profile.default" | |
cp -u --no-preserve=mode,owner "/nix/store/0b5gv475pka697qr3nm5h430ad3p4fn1-tor-browser-bundle-bin-11.0.2/share/tor-browser/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/* | |
# XDG | |
: "${XDG_RUNTIME_DIR:=/run/user/$(id -u)}" | |
: "${XDG_CONFIG_HOME:=$REAL_HOME/.config}" | |
# Figure out some envvars for pulseaudio | |
: "${PULSE_SERVER:=$XDG_RUNTIME_DIR/pulse/native}" | |
: "${PULSE_COOKIE:=$XDG_CONFIG_HOME/pulse/cookie}" | |
# Font cache files capture store paths; clear them out on the off | |
# chance that TBB would continue using old font files. | |
rm -rf "$HOME/.cache/fontconfig" | |
# Manually specify data paths (by default TB attempts to create these in the store) | |
{ | |
echo "user_pref(\"extensions.torlauncher.toronionauthdir_path\", \"$HOME/TorBrowser/Data/Tor/onion-auth\");" | |
echo "user_pref(\"extensions.torlauncher.torrc_path\", \"$HOME/TorBrowser/Data/Tor/torrc\");" | |
echo "user_pref(\"extensions.torlauncher.tordatadir_path\", \"$HOME/TorBrowser/Data/Tor\");" | |
} >> "$HOME/TorBrowser/Data/Browser/profile.default/prefs.js" | |
# Lift-off | |
# | |
# XAUTHORITY and DISPLAY are required for TBB to work at all. | |
# | |
# DBUS_SESSION_BUS_ADDRESS is inherited to avoid auto-launch; to | |
# prevent that, set it to an empty/invalid value prior to running | |
# tor-browser. | |
# | |
# PULSE_SERVER is necessary for audio playback. | |
# | |
# Setting FONTCONFIG_FILE is required to make fontconfig read the TBB | |
# fonts.conf; upstream uses FONTCONFIG_PATH, but FC_DEBUG=1024 | |
# indicates the system fonts.conf being used instead. | |
# | |
# XDG_DATA_DIRS is set to prevent searching system dirs (looking for .desktop & icons) | |
exec env -i LD_PRELOAD=/nix/store/5cmd01n5db5xkfskla9y40ddqq91vmqx-graphene-hardened-malloc-8/lib/libhardened_malloc.so TZ=":" TZDIR="${TZDIR:-}" LOCALE_ARCHIVE="$LOCALE_ARCHIVE" TMPDIR="${TMPDIR:-/tmp}" HOME="$HOME" XAUTHORITY="${XAUTHORITY:-$HOME/.Xauthority}" DISPLAY="$DISPLAY" DBUS_SESSION_BUS_ADDRESS="${DBUS_SESSION_BUS_ADDRESS:-unix:path=$XDG_RUNTIME_DIR/bus}" \ | |
XDG_DATA_HOME="$HOME/.local/share" XDG_DATA_DIRS="/nix/store/k0v0m0m9n4s2w2mq67jjl29ahkf47brd-adwaita-icon-theme-41.0/share:/nix/store/qd3lf16svyad3im8a341ikxj9ixlf0d9-shared-mime-info-2.1/share:/nix/store/jaz6dmzddb1vyrncfyisphna4ly92rag-glib-2.70.1-bin/share/gsettings-schemas/glib-2.70.1:/nix/store/pxwcjz3lc60ffil1z34p1nv8cd9i75jb-gsettings-desktop-schemas-41.0/share/gsettings-schemas/gsettings-desktop-schemas-41.0:/nix/store/5fpv8x3f6yzw0aqrslv3q126xx48lbn7-gtk+3-3.24.30/share/gsettings-schemas/gtk+3-3.24.30" PULSE_SERVER="${PULSE_SERVER:-}" PULSE_COOKIE="${PULSE_COOKIE:-}" APULSE_PLAYBACK_DEVICE="${APULSE_PLAYBACK_DEVICE:-plug:dmix}" TOR_SKIP_LAUNCH="${TOR_SKIP_LAUNCH:-}" TOR_CONTROL_PORT="${TOR_CONTROL_PORT:-}" TOR_SOCKS_PORT="${TOR_SOCKS_PORT:-}" FONTCONFIG_FILE="/nix/store/0b5gv475pka697qr3nm5h430ad3p4fn1-tor-browser-bundle-bin-11.0.2/share/tor-browser/TorBrowser/Data/fontconfig/fonts.conf" LD_LIBRARY_PATH="/nix/store/zbrzcprzpcby9107v8xkph2wks3mk93r-atk-2.36.0/lib:/nix/store/q42c9s1cbyg5inf8ranys485akhaxh3v-cairo-1.16.0/lib:/nix/store/kar5138ikha2f91naig24flqssf6mfr2-dbus-1.12.20-lib/lib:/nix/store/23zr9qap30rhfmy01r1fq181zvxbcdm4-dbus-glib-0.112/lib:/nix/store/dhzv393zvcipx2n45i9cvfnzyr1c4vdd-fontconfig-2.13.94-lib/lib:/nix/store/i7gqvl7s485rn4n8bqa9askbjrvc8s65-freetype-2.11.0/lib:/nix/store/6hwhq9szpm65zhcvhfw42gzdlyi7b2rz-gdk-pixbuf-2.42.6/lib:/nix/store/ldibnigsg44q3wp6v8ikn8kq08lf675c-glib-2.70.1/lib:/nix/store/5fpv8x3f6yzw0aqrslv3q126xx48lbn7-gtk+3-3.24.30/lib:/nix/store/6cy62r6hnzq5yqjj347p6dwv9pw21ixy-libxcb-1.14/lib:/nix/store/w259jz35i221vil0jg2dpdw3zda55ai4-libX11-1.7.2/lib:/nix/store/cfv850gaqmzrs60fpxxkv088zcj74hi3-libXext-1.3.4/lib:/nix/store/8cnqnhl6f6gg7558x44nqgimsdixjshn-libXrender-0.9.10/lib:/nix/store/ynib85kvr5636qjr37g5i9vkasdmac4c-libXt-1.2.1/lib:/nix/store/bn7b7cidb9qgs8m8y83nf247j8j3xjsf-pango-1.48.10/lib:/nix/store/2nkjrh3za68vrw6kf8lxn6nq1dval05v-gcc-10.3.0-lib/lib:/nix/store/563528481rvhc5kxwipjmg6rqrl95mdx-glibc-2.33-56/lib:/nix/store/2zz2l3j07h9bkvdmxhxinj2rcjy3cdh7-zlib-1.2.11/lib:/nix/store/a1b3p02cm1gsy16jwlgg00x9k3kp182r-libpulseaudio-14.2/lib:/nix/store/kdbxzsjxccr060y2hpcz4kvp7jvgnw6x-ffmpeg-4.4.1/lib:/nix/store/0b5gv475pka697qr3nm5h430ad3p4fn1-tor-browser-bundle-bin-11.0.2/share/tor-browser:/nix/store/0b5gv475pka697qr3nm5h430ad3p4fn1-tor-browser-bundle-bin-11.0.2/share/tor-browser/TorBrowser/Tor" "/nix/store/0b5gv475pka697qr3nm5h430ad3p4fn1-tor-browser-bundle-bin-11.0.2/share/tor-browser/firefox" --class "Tor Browser" -no-remote -profile "$HOME/TorBrowser/Data/Browser/profile.default" "${@}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment