Commit 279f606d authored by Tails developers's avatar Tails developers
Browse files

Set the TBB installation paths in its own shell library.

parent 5ea31a3e
......@@ -32,15 +32,13 @@ VERSION="$(echo "${MAIN_BUNDLE}" | sed 's/tor-browser-linux32-\(.*\)_en-US.tar.x
#TBB_DIST_URL="http://www.torproject.org/dist/torbrowser/${VERSION}/"
TBB_DIST_URL="http://people.torproject.org/~mikeperry/builds/${VERSION}/"
# Later we're gonna split TBB's actual browser (binaries etc), user
# data and extension into these folders, respectively. While this
# differs from how the TBB organizes the files, the end result will be
# the same, and it's practical since when creating a new browser
# profile we can simply copy the profile directory without duplicating
# all extensions.
TBB_INSTALL=/usr/local/lib/tor-browser
TBB_PROFILE=/etc/tor-browser/profile
TBB_EXT="${TBB_INSTALL}/extensions"
# Import the TBB_INSTALL, TBB_PROFILE and TBB_EXT variables, which
# contains the paths we will split TBB's actual browser (binaries
# etc), user data and extension into. While this differs from how the
# TBB organizes the files, the end result will be the same, and it's
# practical since when creating a new browser profile we can simply
# copy the profile directory without duplicating all extensions.
. /usr/local/lib/tails-shell-library/tor-browser.sh
mkdir -p "${TBB_INSTALL}" "${TBB_PROFILE}" "${TBB_EXT}"
# Use the builder's caching APT proxy, if any
......
......@@ -6,7 +6,10 @@ set -e
echo "Removing unwanted iceweasel search plugins"
PLUGIN_DIR=/usr/local/lib/tor-browser/Browser/browser/searchplugins
# Import the TBB_INSTALL variable
. /usr/local/lib/tails-shell-library/tor-browser.sh
PLUGIN_DIR="${TBB_INSTALL}"/Browser/browser/searchplugins
rm "${PLUGIN_DIR}"/amazon*.xml
rm "${PLUGIN_DIR}"/bing*.xml
rm "${PLUGIN_DIR}"/eBay*.xml
......
......@@ -9,11 +9,14 @@ echo "Setting up localized browser search plugins"
# linked in '/etc/tor-browser/profile/searchplugins/locale/es-AR',
# '/etc/tor-browser/profile/searchplugins/locale/es-ES', etc.
# Import the TBB_INSTALL and TBB_EXT variables
. /usr/local/lib/tails-shell-library/tor-browser.sh
locales_for_lang() {
local locale="$1"
local langpacks
find /usr/local/lib/tor-browser/extensions -maxdepth 1 -type f -name 'langpack-*@firefox.mozilla.org.xpi' -printf "%P\n" |
find "${TBB_EXT}" -maxdepth 1 -type f -name 'langpack-*@firefox.mozilla.org.xpi' -printf "%P\n" |
sed -n -e "s/^langpack-\($locale\)\(-[A-Z]\+\)\?@firefox.mozilla.org.xpi/\1\2/p"
}
......@@ -24,9 +27,9 @@ for LANGUAGE in $(find /usr/share/amnesia/browser/searchplugins/locale -maxdepth
exit 1
fi
for LOCALE in $LOCALES; do
mkdir -p /usr/local/lib/tor-browser/Browser/distribution/searchplugins/locale/$LOCALE
mkdir -p "${TBB_INSTALL}"/Browser/distribution/searchplugins/locale/$LOCALE
for SEARCHPLUGIN in $(find "/usr/share/amnesia/browser/searchplugins/locale/$LANGUAGE" -maxdepth 1 -type f); do
ln -s "$SEARCHPLUGIN" /usr/local/lib/tor-browser/Browser/distribution/searchplugins/locale/$LOCALE
ln -s "$SEARCHPLUGIN" "${TBB_INSTALL}"/Browser/distribution/searchplugins/locale/$LOCALE
done
done
done
......@@ -2,6 +2,9 @@
set -e
# Import the TBB_INSTALL variable
. /usr/local/lib/tails-shell-library/tor-browser.sh
# The Tor Browser hardcodes the default profile dir to ../.. from the
# folder storing the application.ini file supplied via -app. Sadly,
# -profile doesn't work together with -app. Therefore we copy the
......@@ -24,4 +27,4 @@ EOF
ln -s /var/lib/tails-user-session/browser-locale.js \
"${HOME}"/.tor-launcher/TorBrowser/Data/Browser/profile.default/preferences/locale.js
fi
/usr/local/lib/tor-browser/Browser/firefox --app "${HOME}"/.tor-launcher/tor-launcher-standalone/application.ini
exec "${TBB_INSTALL}"/Browser/firefox --app "${HOME}"/.tor-launcher/tor-launcher-standalone/application.ini
#!/bin/sh
unzip -q -p /usr/local/lib/tor-browser/Browser/browser/omni.ja \
# Import the TBB_INSTALL variable
. /usr/local/lib/tails-shell-library/tor-browser.sh
unzip -q -p "${TBB_INSTALL}"/Browser/browser/omni.ja \
defaults/preferences/000-tor-browser.js | \
sed -n 's@^pref("general\.useragent\.override", "\(.*\)");$@\1@p'
......@@ -11,6 +11,9 @@ export TEXTDOMAIN
PROFILE="${HOME}/.tor-browser/profile.default"
# Import the TBB_INSTALL variable
. /usr/local/lib/tails-shell-library/tor-browser.sh
ask_for_confirmation() {
local dialog_title="`gettext \"Tor is not ready\"`"
local dialog_text="`gettext \"Tor is not ready. Start Tor Browser anyway?\"`"
......@@ -40,7 +43,7 @@ start_browser() {
unset SESSION_MANAGER
exec /usr/local/lib/tor-browser/Browser/firefox -no-remote --class "Tor Browser" -profile "${PROFILE}" "${@}"
exec "${TBB_INSTALL}"/Browser/firefox -no-remote --class "Tor Browser" -profile "${PROFILE}" "${@}"
}
......
#!/bin/sh
TBB_INSTALL=/usr/local/lib/tor-browser
TBB_PROFILE=/etc/tor-browser/profile
TBB_EXT="${TBB_INSTALL}/extensions"
......@@ -4,6 +4,9 @@
# be run as the desktop user. It consists mainly of ugly workarounds. Running this
# script will change the system until next reboot.
# Import the TBB_INSTALL variable
. /usr/local/lib/tails-shell-library/tor-browser.sh
# Activate the camouflage for the next session
install -m 0644 \
/usr/share/applications/tails-activate-win8-theme.desktop \
......@@ -17,8 +20,8 @@ for icon in /usr/share/icons/hicolor/*/apps/pidgin.png; do
done
# Set Tor Browser application icon
for icon in /usr/local/lib/tor-browser/Browser/browser/chrome/icons/default/*.png \
/usr/local/lib/tor-browser/Browser/browser/icons/*.png; do
for icon in "${TBB_INSTALL}"/Browser/browser/chrome/icons/default/*.png \
"${TBB_INSTALL}"/Browser/browser/icons/*.png; do
rm "$icon"
ln -s "/usr/share/icons/Windows8/apps/iceweasel.png" "$icon"
done
......
......@@ -18,6 +18,9 @@ CLEARNET_USER=clearnet
# Import tor_is_working()
. /usr/local/lib/tails-shell-library/tor.sh
# Import the TBB_INSTALL, TBB_EXT and TBB_PROFILE variables
. /usr/local/lib/tails-shell-library/tor-browser.sh
WARNING_PAGE='/usr/share/doc/tails/website/misc/unsafe_browser_warning'
LANG_CODE="$(echo ${LANG} | head -c 2)"
if [ -r "${WARNING_PAGE}.${LANG_CODE}.html" ]; then
......@@ -108,7 +111,7 @@ set_chroot_browser_name () {
NAME="${1}"
LONG=$(echo ${LANG} | grep -o "^[a-zA-Z_]*")
SHORT=${LONG%%_*}
EXT_DIR=${CHROOT}/usr/local/lib/tor-browser/extensions
EXT_DIR=${CHROOT}/"${TBB_EXT}"
BRANDING=branding/brand.dtd
if [ -e "${EXT_DIR}/langpack-${LONG}@firefox.mozilla.org.xpi" ]; then
PACK="${EXT_DIR}/langpack-${LONG}@firefox.mozilla.org.xpi"
......@@ -119,7 +122,7 @@ set_chroot_browser_name () {
TOP=browser/chrome
REST=${SHORT}/locale
else
PACK="${CHROOT}/usr/local/lib/tor-browser/Browser/browser/omni.ja"
PACK="${CHROOT}/"${TBB_EXT}"/Browser/browser/omni.ja"
TOP=chrome
REST=en-US/locale
fi
......@@ -156,8 +159,8 @@ configure_chroot () {
CLEARNET_EXT="${CLEARNET_PROFILE}"/extensions
mkdir -p "${CLEARNET_EXT}"
cp -Pr /etc/tor-browser/profile/extensions/langpack-*.xpi \
/etc/tor-browser/profile/extensions/branding@amnesia.boum.org \
cp -Pr "${TBB_PROFILE}"/extensions/langpack-*.xpi \
"${TBB_PROFILE}"/extensions/branding@amnesia.boum.org \
"${CLEARNET_EXT}"
CLEARNET_PREFS="${CLEARNET_PROFILE}"/preferences/prefs.js
......@@ -178,7 +181,7 @@ configure_chroot () {
"${CLEARNET_PREFS}"
# Remove all bookmarks
rm -f ${CHROOT}/etc/tor-browser/default.profile/bookmarks.html
rm -f ${CHROOT}/"${TBB_PROFILE}"/bookmarks.html
rm -f ${CLEARNET_PROFILE}/bookmarks.html
rm -f ${CLEARNET_PROFILE}/places.sqlite
......@@ -206,7 +209,7 @@ run_browser_in_chroot () {
echo "* Starting Unsafe Browser"
sudo -u ${SUDO_USER} xhost +SI:localuser:${CLEARNET_USER} 2>/dev/null
chroot ${CHROOT} sudo -u ${CLEARNET_USER} /usr/local/lib/tor-browser/Browser/firefox -DISPLAY=:0.0 -profile /home/clearnet/.tor-browser/profile.default
chroot ${CHROOT} sudo -u ${CLEARNET_USER} "${TBB_INSTALL}"/Browser/firefox -DISPLAY=:0.0 -profile /home/clearnet/.tor-browser/profile.default
sudo -u ${SUDO_USER} xhost -SI:localuser:${CLEARNET_USER} 2>/dev/null
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment