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

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