Commit 57135a4f authored by Tails developers's avatar Tails developers

Refactor chroot browsers' run_browser_in_chroot().

parent 6f6a8fdc
......@@ -90,3 +90,17 @@ set_chroot_browser_name () {
chmod a+r "${pack}"
rm -Rf "${tmp}"
}
# Start the browser in the chroot
run_chroot_browser () {
local chroot="${1}"
local chroot_user="${2}"
local local_user="${3}"
sudo -u ${local_user} xhost +SI:localuser:${chroot_user} 2>/dev/null
chroot ${chroot} sudo -u ${chroot_user} /bin/sh -c \
'. /usr/local/lib/tails-shell-library/tor-browser.sh && \
exec_firefox -DISPLAY=:0.0 \
-profile /home/'"${chroot_user}"'/.tor-browser/profile.default'
sudo -u ${local_user} xhost -SI:localuser:${chroot_user} 2>/dev/null
}
......@@ -279,18 +279,6 @@ EOF
}
run_browser_in_chroot () {
# Start Iceweasel in the chroot
echo "* Starting I2P Browser"
sudo -u ${SUDO_USER} xhost +SI:localuser:${BROWSER_USER} 2>/dev/null
chroot ${CHROOT} sudo -u ${BROWSER_USER} /bin/sh -c \
". /usr/local/lib/tails-shell-library/tor-browser.sh && \
exec_firefox -DISPLAY=:0.0 \
-profile /home/${BROWSER_USER}/.tor-browser/profile.default"
sudo -u ${SUDO_USER} xhost -SI:localuser:${BROWSER_USER} 2>/dev/null
}
show_shutdown_notification () {
local title="`gettext \"Shutting down the I2P Browser...\"`"
local body="`gettext \"This may take a while, and you may not restart the I2P Browser until it is properly shut down.\"`"
......@@ -311,7 +299,8 @@ echo "* Setting up chroot"
setup_browser_chroot ${CHROOT} ${COW} || \
error "`gettext \"Failed to setup chroot.\"`"
configure_chroot
run_browser_in_chroot
echo "* Starting I2P Browser"
run_chroot_browser ${CHROOT} ${BROWSER_USER} ${SUDO_USER}
show_shutdown_notification
exit 0
......@@ -157,18 +157,6 @@ EOF
}
run_browser_in_chroot () {
# Start the browser in the chroot
echo "* Starting Unsafe Browser"
sudo -u ${SUDO_USER} xhost +SI:localuser:${CLEARNET_USER} 2>/dev/null
chroot ${CHROOT} sudo -u ${CLEARNET_USER} /bin/sh -c \
'. /usr/local/lib/tails-shell-library/tor-browser.sh && \
exec_firefox -DISPLAY=:0.0 \
-profile /home/clearnet/.tor-browser/profile.default'
sudo -u ${SUDO_USER} xhost -SI:localuser:${CLEARNET_USER} 2>/dev/null
}
show_shutdown_notification () {
local title="`gettext \"Shutting down the Unsafe Browser...\"`"
local body="`gettext \"This may take a while, and you may not restart the Unsafe Browser until it is properly shut down.\"`"
......@@ -213,7 +201,8 @@ echo "* Setting up chroot"
setup_browser_chroot ${CHROOT} ${COW} || \
error "`gettext \"Failed to setup chroot.\"`"
configure_chroot
run_browser_in_chroot
echo "* Starting Unsafe Browser"
run_chroot_browser ${CHROOT} ${CLEARNET_USER} ${SUDO_USER}
show_shutdown_notification
maybe_restart_tor
......
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