Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
tails
tails
Commits
a42ab6d3
Commit
a42ab6d3
authored
Oct 21, 2014
by
Tails developers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Localize the I2P router console.
parent
b6aad30b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
2 deletions
+48
-2
config/chroot_local-includes/usr/local/lib/tails-shell-library/common.sh
...ocal-includes/usr/local/lib/tails-shell-library/common.sh
+12
-0
config/chroot_local-includes/usr/local/lib/tails-shell-library/i2p.sh
...t_local-includes/usr/local/lib/tails-shell-library/i2p.sh
+24
-0
config/chroot_local-includes/usr/local/sbin/tails-i2p
config/chroot_local-includes/usr/local/sbin/tails-i2p
+12
-2
No files found.
config/chroot_local-includes/usr/local/lib/tails-shell-library/common.sh
View file @
a42ab6d3
...
...
@@ -20,3 +20,15 @@ wait_until() {
try_for
()
{
wait_until
"
${
@
}
"
}
set_key
()
{
local
key
=
"
${
1
}
"
local
value
=
"
${
2
}
"
local
file
=
"
${
3
}
"
local
op
=
"
${
4
:-
=
}
"
if
grep
-q
"^
${
key
}${
op
}
"
"
${
file
}
"
;
then
sed
-i
-n
"s/^
${
key
}${
op
}
.*
$/
${
key
}${
op
}${
value
}
/p"
"
${
file
}
"
else
echo
"
${
key
}${
op
}${
value
}
"
>>
"
${
file
}
"
fi
}
config/chroot_local-includes/usr/local/lib/tails-shell-library/i2p.sh
View file @
a42ab6d3
#!/bin/sh
# Import set_key().
.
/usr/local/lib/tails-shell-library/common.sh
# Import language_code_from_locale().
.
/usr/local/lib/tails-shell-library/localization.sh
I2P_DEFAULT_CONFIG
=
"/usr/share/i2p"
I2P_CONFIG
=
"/var/lib/i2p/i2p-config"
I2P_TUNNEL_CONFIG
=
"
${
I2P_CONFIG
}
/i2ptunnel.config"
...
...
@@ -31,3 +38,20 @@ i2p_router_console_address() {
i2p_router_console_is_ready
()
{
netstat
-4nlp
|
grep
-qwF
"
$(
i2p_router_console_address
)
"
}
set_best_i2p_router_console_lang
()
{
# We will use the detected language even if I2P supports it; it
# will default to English in that case.
local
lang
=
"
$(
language_code_from_locale
"
${
LANG
}
"
)
"
# We first try to set it in an existing "live" config, even though
# the effect will only appear after a restart.
local
config
for
config
in
"
${
I2P_CONFIG
}
/router.config"
\
"
${
I2P_DEFAULT_CONFIG
}
/router.config"
;
do
if
[
-e
"
${
config
}
"
]
;
then
set_key
"routerconsole.lang"
"
${
lang
}
"
"
${
config
}
"
return
0
fi
done
return
1
}
config/chroot_local-includes/usr/local/sbin/tails-i2p
View file @
a42ab6d3
...
...
@@ -16,7 +16,8 @@ set -u
# Import wait_until()
.
/usr/local/lib/tails-shell-library/common.sh
# Import i2p_has_bootstrapped() and i2p_router_console_is_ready()
# Import i2p_has_bootstrapped(), i2p_router_console_is_ready() and
# set_best_i2p_router_console_lang().
.
/usr/local/lib/tails-shell-library/i2p.sh
I2P_STARTUP_TIMEOUT
=
60
...
...
@@ -62,7 +63,16 @@ notify_bootstrap_success() {
case
"
${
1
}
"
in
start|restart
)
service i2p restart
# Stop I2P before setting the router console language in case
# it pushes any updated options on quit.
if
service i2p status
;
then
service i2p stop
fi
# Get LANG, since we may run this from an environment that
# doesn't have it set.
.
/etc/default/locale
set_best_i2p_router_console_lang
service i2p start
wait_until_i2p_router_console_is_ready
||
startup_failure
notify_router_console_success
wait_until_i2p_has_bootstrapped
||
bootstrap_failure
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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