Commit 278cd2d8 authored by Tails developers's avatar Tails developers
Browse files

Reorganize chroot browser scripts.

No code is deleted/added/modified, only moved.
parent 4b4f6bc6
......@@ -2,25 +2,6 @@
set -e
# This isn't very useful without I2P...
grep -qw "i2p" /proc/cmdline || exit 0
CMD=$(basename ${0})
LOCK=/var/lock/${CMD}
. gettext.sh
TEXTDOMAIN="tails"
export TEXTDOMAIN
. /usr/local/lib/tails-shell-library/i2p.sh
CONF_DIR=/var/lib/i2p-browser
COW=${CONF_DIR}/cow
CHROOT=${CONF_DIR}/chroot
BROWSER_NAME=i2p-browser
BROWSER_USER=i2pbrowser
START_PAGE="http://127.0.0.1:7657"
# Import the TBB_EXT variable, and guess_best_tor_browser_locale().
. /usr/local/lib/tails-shell-library/tor-browser.sh
......@@ -28,10 +9,7 @@ START_PAGE="http://127.0.0.1:7657"
. /usr/local/lib/tails-shell-library/tor-browser.sh
. /usr/local/lib/tails-shell-library/chroot-browser.sh
NOSCRIPT_EXT_XPI="${TBB_EXT}/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi"
TORBUTTON_EXT_DIR="${TBB_EXT}/torbutton@torproject.org"
HUMAN_READABLE_NAME="`gettext \"I2P Browser\"`"
. /usr/local/lib/tails-shell-library/i2p.sh
cleanup () {
try_cleanup_browser_chroot ${CHROOT} ${COW} ${BROWSER_USER}
......@@ -89,6 +67,29 @@ show_shutdown_notification () {
tails-notify-user "${title}" "${body}" 10000
}
# Main script:
# This isn't very useful without I2P...
grep -qw "i2p" /proc/cmdline || exit 0
CMD=$(basename ${0})
LOCK=/var/lock/${CMD}
. gettext.sh
TEXTDOMAIN="tails"
export TEXTDOMAIN
CONF_DIR=/var/lib/i2p-browser
COW=${CONF_DIR}/cow
CHROOT=${CONF_DIR}/chroot
BROWSER_NAME=i2p-browser
BROWSER_USER=i2pbrowser
START_PAGE="http://127.0.0.1:7657"
NOSCRIPT_EXT_XPI="${TBB_EXT}/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi"
TORBUTTON_EXT_DIR="${TBB_EXT}/torbutton@torproject.org"
HUMAN_READABLE_NAME="`gettext \"I2P Browser\"`"
BEST_LOCALE="$(guess_best_tor_browser_locale)"
# Prevent multiple instances of the script.
exec 9>${LOCK}
if ! flock -x -n 9; then
......@@ -110,7 +111,6 @@ configure_chroot_browser "${CHROOT}" "${BROWSER_NAME}" "${BROWSER_USER}" \
"${START_PAGE}" "${TBB_EXT}"/langpack-*.xpi \
"${NOSCRIPT_EXT_XPI}" "${TORBUTTON_EXT_DIR}"
copy_extra_tbb_prefs "${CHROOT}" "${BROWSER_USER}"
BEST_LOCALE="$(guess_best_tor_browser_locale)"
set_chroot_browser_locale "${CHROOT}" "${BROWSER_USER}" "${BEST_LOCALE}"
set_chroot_torbutton_browser_name "${CHROOT}" "${HUMAN_READABLE_NAME}" "${BEST_LOCALE}"
set_chroot_browser_permissions "${CHROOT}" "${BROWSER_USER}"
......
......@@ -2,19 +2,6 @@
set -e
CMD=$(basename ${0})
LOCK=/var/lock/${CMD}
. gettext.sh
TEXTDOMAIN="tails"
export TEXTDOMAIN
CONF_DIR=/var/lib/unsafe-browser
COW=${CONF_DIR}/cow
CHROOT=${CONF_DIR}/chroot
BROWSER_NAME=unsafe-browser
BROWSER_USER=clearnet
# Import tor_is_working()
. /usr/local/lib/tails-shell-library/tor.sh
......@@ -23,14 +10,6 @@ BROWSER_USER=clearnet
. /usr/local/lib/tails-shell-library/chroot-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
START_PAGE="${WARNING_PAGE}.${LANG_CODE}.html"
else
START_PAGE="${WARNING_PAGE}.en.html"
fi
cleanup () {
try_cleanup_browser_chroot ${CHROOT} ${COW} ${BROWSER_USER}
}
......@@ -85,6 +64,31 @@ maybe_restart_tor () {
fi
}
# Main script:
CMD=$(basename ${0})
LOCK=/var/lock/${CMD}
. gettext.sh
TEXTDOMAIN="tails"
export TEXTDOMAIN
CONF_DIR=/var/lib/unsafe-browser
COW=${CONF_DIR}/cow
CHROOT=${CONF_DIR}/chroot
BROWSER_NAME=unsafe-browser
BROWSER_USER=clearnet
NM_ENV=/var/lib/NetworkManager/env
BEST_LOCALE="$(guess_best_tor_browser_locale)"
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
START_PAGE="${WARNING_PAGE}.${LANG_CODE}.html"
else
START_PAGE="${WARNING_PAGE}.en.html"
fi
# Prevent multiple instances of the script.
exec 9>${LOCK}
if ! flock -x -n 9; then
......@@ -92,7 +96,6 @@ if ! flock -x -n 9; then
fi
# Get the DNS servers that was obtained from NetworkManager, if any...
NM_ENV=/var/lib/NetworkManager/env
if [ -r "${NM_ENV}" ]; then
. ${NM_ENV}
fi
......@@ -115,7 +118,6 @@ echo "* Configuring chroot"
configure_chroot_dns_servers "${CHROOT}" "${IP4_NAMESERVERS}"
configure_chroot_browser "${CHROOT}" "${BROWSER_NAME}" "${BROWSER_USER}" \
"${START_PAGE}" "${TBB_EXT}"/langpack-*.xpi
BEST_LOCALE="$(guess_best_tor_browser_locale)"
set_chroot_browser_locale "${CHROOT}" "${BROWSER_USER}" "${BEST_LOCALE}"
set_chroot_browser_name ${CHROOT} "`gettext \"Unsafe Browser\"`" "${BEST_LOCALE}"
set_chroot_browser_permissions "${CHROOT}" "${BROWSER_USER}"
......
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