1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
| | Change TorBrowser startup script in order for it to setup needed files
outside guix store. Remove tests which are not needed on guix system.
--- torbrowser-68.10.0esr-9.5-1/tbb-scripts/RelativeLink/start-tor-browser.orig 2020-07-05 18:47:40.685485004 -0300
+++ torbrowser-68.10.0esr-9.5-1/tbb-scripts/RelativeLink/start-tor-browser 2020-07-23 18:13:32.426282743 -0300
@@ -5,6 +5,14 @@
#
# Copyright 2017 The Tor Project. See LICENSE for licensing information.
+TBB_HOME="${HOME}/.local/share/torbrowser"
+TBB_LOGFILE="${TBB_HOME}/torbrowser.log"
+TBB_DATA="${TBB_HOME}/Data"
+TBB_PROFILE="${TBB_DATA}/Browser/profile.default"
+TBB_STORE_PATH=$(dirname $(realpath "$0"))
+TBB_STORE_DATA="${TBB_STORE_PATH}/TorBrowser/Data"
+TORRC="${TBB_DATA}/Tor/torrc-defaults"
+
complain_dialog_title="Tor Browser"
# First, make sure DISPLAY is set. If it isn't, we're hosed; scream
@@ -134,8 +142,8 @@
;;
-l | --log)
if [ -z "$2" -o "${2:0:1}" == "-" ]; then
- printf "Logging Tor Browser debug information to tor-browser.log\n"
- logfile="../tor-browser.log"
+ printf "Logging Tor Browser debug information to torbrowser.log\n"
+ logfile="${TBB_LOGFILE}"
elif [ "${2:0:1}" == "/" -o "${2:0:1}" == "~" ]; then
printf "Logging Tor Browser debug information to %s\n" "$2"
logfile="$2"
@@ -187,41 +195,22 @@
export XAUTHORITY
fi
-# If this script is being run through a symlink, we need to know where
-# in the filesystem the script itself is, not where the symlink is.
-myname="$0"
-if [ -L "$myname" ]; then
- # XXX readlink is not POSIX, but is present in GNU coreutils
- # and on FreeBSD. Unfortunately, the -f option (which follows
- # a whole chain of symlinks until it reaches a non-symlink
- # path name) is a GNUism, so we have to have a fallback for
- # FreeBSD. Fortunately, FreeBSD has realpath instead;
- # unfortunately, that's also non-POSIX and is not present in
- # GNU coreutils.
- #
- # If this launcher were a C program, we could just use the
- # realpath function, which *is* POSIX. Too bad POSIX didn't
- # make that function accessible to shell scripts.
-
- # If realpath is available, use it; it Does The Right Thing.
- possibly_my_real_name="`realpath "$myname" 2>/dev/null`"
- if [ "$?" -eq 0 ]; then
- myname="$possibly_my_real_name"
- else
- # realpath is not available; hopefully readlink -f works.
- myname="`readlink -f "$myname" 2>/dev/null`"
- if [ "$?" -ne 0 ]; then
- # Ugh.
- complain "start-tor-browser cannot be run using a symlink on this operating system."
- fi
- fi
+# Try to be agnostic to where we're being started from, check if files are on its
+# default paths and chdir to TBB_HOME
+if [ -e "${TORRC}" ]; then
+ cd "${TBB_HOME}"
+else
+ mkdir -p "${TBB_HOME}"
+ cp -R "${TBB_STORE_DATA}" "${TBB_HOME}"
+ chmod -R 700 "${TBB_HOME}"
+ mkdir -p "${TBB_PROFILE}"
+ echo "user_pref(\"extensions.torlauncher.torrc-defaults_path\", \"${TORRC}\");"\
+ > "${TBB_PROFILE}/user.js"
+ echo "ClientTransportPlugin meek_lite,obfs2,obfs3,obfs4,scramblesuit exec ${TBB_STORE_PATH}/TorBrowser/Tor/PluggableTransports/obfs4proxy"\
+ >> "${TORRC}"
+ cd "${TBB_HOME}"
fi
-# Try to be agnostic to where we're being started from, chdir to where
-# the script is.
-mydir="`dirname "$myname"`"
-test -d "$mydir" && cd "$mydir"
-
# If ${PWD} results in a zero length string, we can try something else...
if [ ! "${PWD}" ]; then
# "hacking around some braindamage"
@@ -236,16 +225,9 @@
ln -nsf ~/.config/ibus/bus .config/ibus
fi
-# Fix up .desktop Icon and Exec Paths, and update the .desktop file from the
-# canonical version if it was changed by the updater.
-cp start-tor-browser.desktop ../
-sed -i -e "s,^Name=.*,Name=Tor Browser,g" ../start-tor-browser.desktop
-sed -i -e "s,^Icon=.*,Icon=$PWD/browser/chrome/icons/default/default128.png,g" ../start-tor-browser.desktop
-sed -i -e "s,^Exec=.*,Exec=sh -c '\"$PWD/start-tor-browser\" --detach || ([ ! -x \"$PWD/start-tor-browser\" ] \&\& \"\$(dirname \"\$*\")\"/Browser/start-tor-browser --detach)' dummy %k,g" ../start-tor-browser.desktop
-
if [ "$register_desktop_app" -eq 1 ]; then
mkdir -p "$HOME/.local/share/applications/"
- cp ../start-tor-browser.desktop "$HOME/.local/share/applications/"
+ cp "${TBB_STORE_PATH}/start-tor-browser.desktop" "$HOME/.local/share/applications/"
update-desktop-database "$HOME/.local/share/applications/"
printf "Tor Browser has been registered as a desktop app for this user in ~/.local/share/applications/\n"
exit 0
@@ -265,21 +247,6 @@
HOME="${PWD}"
export HOME
-SYSARCHITECTURE=$(getconf LONG_BIT)
-TORARCHITECTURE=$(expr "$(file TorBrowser/Tor/tor)" : '.*ELF \([[:digit:]]*\)')
-
-if [ $SYSARCHITECTURE -ne $TORARCHITECTURE ]; then
- complain "Wrong architecture? 32-bit vs. 64-bit."
- exit 1
-fi
-
-[% IF c("var/asan") -%]
-# We need to disable LSan which is enabled by default now. Otherwise we'll get
-# a crash during shutdown: https://bugs.torproject.org/10599#comment:59
-ASAN_OPTIONS="detect_leaks=0"
-export ASAN_OPTIONS
-[% END -%]
-
function setControlPortPasswd() {
local ctrlPasswd=$1
@@ -342,13 +309,15 @@
# your password in the following line where the word “secret” is:
setControlPortPasswd ${TOR_CONTROL_PASSWD:='"secret"'}
-# Set up custom bundled fonts. See fonts-conf(5).
-export FONTCONFIG_PATH="${HOME}/TorBrowser/Data/fontconfig"
-export FONTCONFIG_FILE="fonts.conf"
-
# Avoid overwriting user's dconf values. Fixes #27903.
export GSETTINGS_BACKEND=memory
+# Set up custom bundled fonts. See fonts-conf(5).
+export FONTCONFIG_FILE="${HOME}/Data/fontconfig/fonts.conf"
+
+sed -i "${FONTCONFIG_FILE}"\
+ -e "s,<dir>fonts</dir>,<dir>${TBB_STORE_PATH}/fonts</dir>,"
+
cd "${HOME}"
# We pass all additional command-line arguments we get to Firefox.
@@ -357,23 +326,23 @@
if [ "$show_usage" -eq 1 ]; then
# Display Firefox help, then our help
- TOR_CONTROL_PASSWD=${TOR_CONTROL_PASSWD} ./firefox --class "Tor Browser" \
- -profile TorBrowser/Data/Browser/profile.default --help 2>/dev/null
+ TOR_CONTROL_PASSWD=${TOR_CONTROL_PASSWD} ${TBB_STORE_PATH}/firefox --class "Tor Browser" \
+ -profile Data/Browser/profile.default --help 2>/dev/null
tbb_usage
elif [ "$detach" -eq 1 ] ; then
- TOR_CONTROL_PASSWD=${TOR_CONTROL_PASSWD} ./firefox --class "Tor Browser" \
- -profile TorBrowser/Data/Browser/profile.default "${@}" > "$logfile" 2>&1 </dev/null &
+ TOR_CONTROL_PASSWD=${TOR_CONTROL_PASSWD} ${TBB_STORE_PATH}/firefox --class "Tor Browser" \
+ -profile Data/Browser/profile.default "${@}" > "$logfile" 2>&1 </dev/null &
disown "$!"
elif [ "$log_output" -eq 1 -a "$show_output" -eq 1 ]; then
- TOR_CONTROL_PASSWD=${TOR_CONTROL_PASSWD} ./firefox --class "Tor Browser" \
- -profile TorBrowser/Data/Browser/profile.default "${@}" 2>&1 </dev/null | \
+ TOR_CONTROL_PASSWD=${TOR_CONTROL_PASSWD} ${TBB_STORE_PATH}/firefox --class "Tor Browser" \
+ -profile Data/Browser/profile.default "${@}" 2>&1 </dev/null | \
tee "$logfile"
elif [ "$show_output" -eq 1 ]; then
- TOR_CONTROL_PASSWD=${TOR_CONTROL_PASSWD} ./firefox --class "Tor Browser" \
- -profile TorBrowser/Data/Browser/profile.default "${@}" < /dev/null
+ TOR_CONTROL_PASSWD=${TOR_CONTROL_PASSWD} ${TBB_STORE_PATH}/firefox --class "Tor Browser" \
+ -profile Data/Browser/profile.default "${@}" < /dev/null
else
- TOR_CONTROL_PASSWD=${TOR_CONTROL_PASSWD} ./firefox --class "Tor Browser" \
- -profile TorBrowser/Data/Browser/profile.default "${@}" > "$logfile" 2>&1 </dev/null
+ TOR_CONTROL_PASSWD=${TOR_CONTROL_PASSWD} ${TBB_STORE_PATH}/firefox --class "Tor Browser" \
+ -profile Data/Browser/profile.default "${@}" > "$logfile" 2>&1 </dev/null
fi
exit $?
|