Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tails
tails
Commits
0a090a4a
Commit
0a090a4a
authored
Oct 20, 2014
by
Tails developers
Browse files
Refactor chroot browsers' cleanup().
parent
b47dc236
Changes
3
Hide whitespace changes
Inline
Side-by-side
config/chroot_local-includes/usr/local/lib/tails-shell-library/chroot-browser.sh
0 → 100644
View file @
0a090a4a
#!/bin/sh
# Import the TBB_EXT variable.
.
/usr/local/lib/tails-shell-library/tor-browser.sh
# Break down the chroot and kill all of its processes
try_cleanup_browser_chroot
()
{
local chroot
=
"
${
1
}
"
local
cow
=
"
${
2
}
"
local
user
=
"
${
3
}
"
local
counter
=
0
local
ret
=
0
while
[
"
${
counter
}
"
-le
10
]
&&
\
pgrep
-u
${
user
}
1>/dev/null 2>&1
;
do
pkill
-u
${
user
}
1>/dev/null 2>&1
ret
=
${
?
}
sleep
1
counter
=
$((${
counter
}
+
1
))
done
[
${
ret
}
-eq
0
]
||
pkill
-9
-u
${
user
}
1>/dev/null 2>&1
for
mnt
in
${
chroot
}
/dev
${
chroot
}
/proc
${
chroot
}
${
cow
}
;
do
counter
=
0
while
[
"
${
counter
}
"
-le
10
]
&&
mountpoint
-q
${
mnt
}
2>/dev/null
;
do
umount
${
mnt
}
2>/dev/null
sleep
1
counter
=
$((${
counter
}
+
1
))
done
done
rmdir
${
cow
}
${
chroot
}
2>/dev/null
}
config/chroot_local-includes/usr/local/sbin/i2p-browser
View file @
0a090a4a
...
...
@@ -27,6 +27,8 @@ START_PAGE="http://127.0.0.1:7657"
# guess_best_tor_browser_locale()
.
/usr/local/lib/tails-shell-library/tor-browser.sh
.
/usr/local/lib/tails-shell-library/chroot-browser.sh
NOSCRIPT
=
"
${
TBB_EXT
}
/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi"
TORBUTTON
=
"
${
TBB_EXT
}
/torbutton@torproject.org"
NAME
=
"
`
gettext
\"
I2P Browser
\"
`
"
...
...
@@ -36,26 +38,7 @@ if [ -e /var/lib/gdm3/tails.camouflage ]; then
fi
cleanup
()
{
# Break down the chroot and kill all of its processes
local
counter
=
0
local
ret
=
0
while
[
"
${
counter
}
"
-le
10
]
&&
\
pgrep
-u
${
BROWSER_USER
}
1>/dev/null 2>&1
;
do
pkill
-u
${
BROWSER_USER
}
1>/dev/null 2>&1
ret
=
${
?
}
sleep
1
counter
=
$((${
counter
}
+
1
))
done
[
${
ret
}
-eq
0
]
||
pkill
-9
-u
${
BROWSER_USER
}
1>/dev/null 2>&1
for
mnt
in
${
CHROOT
}
/dev
${
CHROOT
}
/proc
${
CHROOT
}
${
COW
}
;
do
counter
=
0
while
[
"
${
counter
}
"
-le
10
]
&&
mountpoint
-q
${
mnt
}
2>/dev/null
;
do
umount
${
mnt
}
2>/dev/null
sleep
1
counter
=
$((${
counter
}
+
1
))
done
done
rmdir
${
COW
}
${
CHROOT
}
2>/dev/null
try_cleanup_browser_chroot
${
CHROOT
}
${
COW
}
${
BROWSER_USER
}
}
error
()
{
...
...
config/chroot_local-includes/usr/local/sbin/unsafe-browser
View file @
0a090a4a
...
...
@@ -23,6 +23,8 @@ CLEARNET_USER=clearnet
# guess_best_tor_browser_locale()
.
/usr/local/lib/tails-shell-library/tor-browser.sh
.
/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
...
...
@@ -36,26 +38,7 @@ if [ -e /var/lib/gdm3/tails.camouflage ]; then
fi
cleanup
()
{
# Break down the chroot and kill all of its processes
local
counter
=
0
local
ret
=
0
while
[
"
${
counter
}
"
-le
10
]
&&
\
pgrep
-u
${
CLEARNET_USER
}
1>/dev/null 2>&1
;
do
pkill
-u
${
CLEARNET_USER
}
1>/dev/null 2>&1
ret
=
${
?
}
sleep
1
counter
=
$((${
counter
}
+
1
))
done
[
${
ret
}
-eq
0
]
||
pkill
-9
-u
${
CLEARNET_USER
}
1>/dev/null 2>&1
for
mnt
in
${
CHROOT
}
/dev
${
CHROOT
}
/proc
${
CHROOT
}
${
COW
}
;
do
counter
=
0
while
[
"
${
counter
}
"
-le
10
]
&&
mountpoint
-q
${
mnt
}
2>/dev/null
;
do
umount
${
mnt
}
2>/dev/null
sleep
1
counter
=
$((${
counter
}
+
1
))
done
done
rmdir
${
COW
}
${
CHROOT
}
2>/dev/null
try_cleanup_browser_chroot
${
CHROOT
}
${
COW
}
${
CLEARNET_USER
}
}
error
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment