Commit 172d8e9f authored by Tails developers's avatar Tails developers

Properly refactor the chroot browser cleanup.

parent 333c4566
...@@ -27,11 +27,13 @@ try_cleanup_browser_chroot () { ...@@ -27,11 +27,13 @@ try_cleanup_browser_chroot () {
setup_browser_chroot () { setup_browser_chroot () {
local chroot="${1}" local chroot="${1}"
local cow="${2}" local cow="${2}"
local user="${3}"
# FIXME: When LXC matures to the point where it becomes a viable option # FIXME: When LXC matures to the point where it becomes a viable option
# for creating isolated jails, the chroot can be used as its rootfs. # for creating isolated jails, the chroot can be used as its rootfs.
trap cleanup INT local cleanup_cmd="try_cleanup_browser_chroot \"${chroot}\" \"${cow}\" \"${user}\""
trap cleanup EXIT trap "${cleanup_cmd}" INT EXIT
local rootfs_dir local rootfs_dir
local rootfs_dirs_path="/lib/live/mount/rootfs" local rootfs_dirs_path="/lib/live/mount/rootfs"
......
...@@ -18,10 +18,6 @@ set -e ...@@ -18,10 +18,6 @@ set -e
# Import i2p_router_console_is_ready(). # Import i2p_router_console_is_ready().
. /usr/local/lib/tails-shell-library/i2p.sh . /usr/local/lib/tails-shell-library/i2p.sh
cleanup () {
try_cleanup_browser_chroot "${CHROOT}" "${COW}" "${BROWSER_USER}"
}
error () { error () {
local cli_text="${CMD}: `gettext \"error:\"` ${@}" local cli_text="${CMD}: `gettext \"error:\"` ${@}"
local dialog_text="<b><big>`gettext \"Error\"`</big></b> local dialog_text="<b><big>`gettext \"Error\"`</big></b>
...@@ -110,7 +106,7 @@ fi ...@@ -110,7 +106,7 @@ fi
show_start_notification show_start_notification
echo "* Setting up chroot" echo "* Setting up chroot"
setup_browser_chroot "${CHROOT}" "${COW}" || \ setup_browser_chroot "${CHROOT}" "${COW}" "${BROWSER_USER}" || \
error "`gettext \"Failed to setup chroot.\"`" error "`gettext \"Failed to setup chroot.\"`"
echo "* Configuring chroot" echo "* Configuring chroot"
......
...@@ -15,10 +15,6 @@ set -e ...@@ -15,10 +15,6 @@ set -e
# and run_chroot_browser(). # and run_chroot_browser().
. /usr/local/lib/tails-shell-library/chroot-browser.sh . /usr/local/lib/tails-shell-library/chroot-browser.sh
cleanup () {
try_cleanup_browser_chroot "${CHROOT}" "${COW}" "${BROWSER_USER}"
}
error () { error () {
local cli_text="${CMD}: `gettext \"error:\"` ${@}" local cli_text="${CMD}: `gettext \"error:\"` ${@}"
local dialog_text="<b><big>`gettext \"Error\"`</big></b> local dialog_text="<b><big>`gettext \"Error\"`</big></b>
...@@ -117,7 +113,7 @@ verify_start ...@@ -117,7 +113,7 @@ verify_start
show_start_notification show_start_notification
echo "* Setting up chroot" echo "* Setting up chroot"
setup_browser_chroot "${CHROOT}" "${COW}" || \ setup_browser_chroot "${CHROOT}" "${COW}" "${BROWSER_USER}" || \
error "`gettext \"Failed to setup chroot.\"`" error "`gettext \"Failed to setup chroot.\"`"
echo "* Configuring chroot" echo "* Configuring chroot"
......
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