summaryrefslogtreecommitdiffstats
path: root/config/chroot_local-includes
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2020-10-14 13:58:57 +0000
committeranonym <anonym@riseup.net>2020-10-14 13:58:57 +0000
commit41939e7c51aa95dfb935415cde0c490b040c3d60 (patch)
treef3e1e840d75dbdd33c254f97ced2fac166e17fe1 /config/chroot_local-includes
parent8eb1c212bcee6b906c82d21bcb9682707b19edb9 (diff)
parent10eda093c0e36eb87257dc0a44e0b3a47ace949c (diff)
Merge branch 'bugfix/17958-update-url-in-upgrader-wrapper' into 'stable'
Electrum & Upgrader wrappers: fix i18n support and use canonical URL for manual upgrade doc Closes #17958 and #17758 See merge request tails/tails!198
Diffstat (limited to 'config/chroot_local-includes')
-rwxr-xr-xconfig/chroot_local-includes/usr/local/bin/electrum22
-rwxr-xr-xconfig/chroot_local-includes/usr/local/bin/tails-upgrade-frontend-wrapper19
2 files changed, 22 insertions, 19 deletions
diff --git a/config/chroot_local-includes/usr/local/bin/electrum b/config/chroot_local-includes/usr/local/bin/electrum
index e3f9b11..b3e4915 100755
--- a/config/chroot_local-includes/usr/local/bin/electrum
+++ b/config/chroot_local-includes/usr/local/bin/electrum
@@ -14,14 +14,14 @@ goodcrypto.com converted from bash to python and added basic tests.
<BLANKLINE>
"""
+import gettext
import os
import sys
import subprocess
-from gettext import gettext
-
import sh
-os.environ['TEXTDOMAIN'] = 'tails'
+translation = gettext.translation("tails", '/usr/share/locale', fallback=True)
+_ = translation.gettext
HOME_DIR = os.environ['HOME']
CONF_DIR = os.path.join(HOME_DIR, '.electrum')
@@ -35,7 +35,9 @@ def main(*args):
# Disable update checking for all users (even those who made their config
# persistent before we changed this value in the default config), because
# users can't easily update to a new version anyway if it's not in Debian.
- subprocess.run(['/usr/bin/electrum', '--offline', 'setconfig', 'check_updates', 'false'], check=True, stdout=subprocess.DEVNULL)
+ subprocess.run(['/usr/bin/electrum', '--offline',
+ 'setconfig', 'check_updates', 'false'],
+ check=True, stdout=subprocess.DEVNULL)
os.execv('/usr/bin/electrum', ['/usr/bin/electrum'] + list(args))
@@ -59,14 +61,14 @@ def verify_start():
True
"""
- disabled_text = gettext('Persistence is disabled for Electrum')
- warning_text = gettext(
+ disabled_text = _('Persistence is disabled for Electrum')
+ warning_text = _(
"When you reboot Tails, all of Electrum's data will be lost, including your Bitcoin wallet.\nIt is strongly recommended to only run Electrum when its persistence feature is activated.")
- question_text = gettext('Do you want to start Electrum anyway?')
+ question_text = _('Do you want to start Electrum anyway?')
dialog_msg = ('<b><big>{}</big></b>\n\n{}\n\n{}\n'.
format(disabled_text, warning_text, question_text))
- launch_text = gettext('_Launch')
- exit_text = gettext('_Exit')
+ launch_text = _('_Launch')
+ exit_text = _('_Exit')
# results 0 == True; 1 == False; 5 == Timeout
results = sh.zenity('--question', '--title', '', '--default-cancel',
@@ -74,7 +76,7 @@ def verify_start():
'--ok-label', launch_text,
'--cancel-label', exit_text,
'--text', dialog_msg,
- _ok_code=[0,1,5])
+ _ok_code=[0, 1, 5])
start = results.exit_code == 0
return start
diff --git a/config/chroot_local-includes/usr/local/bin/tails-upgrade-frontend-wrapper b/config/chroot_local-includes/usr/local/bin/tails-upgrade-frontend-wrapper
index fef47b0..05c1f0a 100755
--- a/config/chroot_local-includes/usr/local/bin/tails-upgrade-frontend-wrapper
+++ b/config/chroot_local-includes/usr/local/bin/tails-upgrade-frontend-wrapper
@@ -14,16 +14,17 @@ goodcrypto.com converted from bash to python and added basic tests.
<BLANKLINE>
"""
+import gettext
import os
+import psutil
import sys
-import time
-from gettext import gettext
-
import sh
-import psutil
+import time
os.environ['PATH'] = '/usr/local/bin:/usr/bin:/bin'
-os.environ['TEXTDOMAIN'] = 'tails'
+
+translation = gettext.translation("tails", '/usr/share/locale', fallback=True)
+_ = translation.gettext
CMD = os.path.basename(sys.argv[0])
# While running iuk.git:features/frontend:
@@ -32,7 +33,7 @@ CMD = os.path.basename(sys.argv[0])
MIN_AVAILABLE_MEMORY = (200 * 1024 * 1024) # In Bytes
RUN_AS_USER = 'tails-upgrade-frontend'
-ERROR_MESSAGE = gettext('''\"<b>Not enough memory available to check for upgrades.</b>
+ERROR_MESSAGE = _('''<b>Not enough memory available to check for upgrades.</b>
Make sure this system satisfies the requirements for running Tails.
See file:///usr/share/doc/tails/website/doc/about/requirements.en.html
@@ -40,7 +41,7 @@ See file:///usr/share/doc/tails/website/doc/about/requirements.en.html
Try to restart Tails to check for upgrades again.
Or do a manual upgrade.
-See https://tails.boum.org/doc/first_steps/upgrade#manual\"''')
+See https://tails.boum.org/doc/upgrade#manual''')
def main(*args):
@@ -70,8 +71,8 @@ def main(*args):
def error(msg):
"""Show error and exit."""
- cli_text = '{}: {} {}'.format(CMD, gettext('error:'), msg)
- dialog_text = '''<b><big>{}</big></b>\n\n{}'''.format(gettext('Error'),
+ cli_text = '{}: {} {}'.format(CMD, _('error:'), msg)
+ dialog_text = '''<b><big>{}</big></b>\n\n{}'''.format(_('Error'),
msg)
print(cli_text, file=sys.stderr)