Merge remote-tracking branch 'flapflap/de-network_configuration'
[tails-test.git] / config / chroot_local-hooks / 14-add_localized_browser_searchplugins
bloba527c34b7ab34a96749a950baf6bd79b47b6e0a9
1 #!/bin/sh
3 set -e
5 echo "Setting up localized browser search plugins"
7 # Link localized Tails searchplugins to the proper localization directories:
8 # e.g. files in '/usr/share/amnesia/browser/searchplugins/locale/es' will be
9 # linked in '/etc/tor-browser/profile/searchplugins/locale/es-AR',
10 # '/etc/tor-browser/profile/searchplugins/locale/es-ES', etc.
12 # Import the TBB_INSTALL and TBB_EXT variables
13 . /usr/local/lib/tails-shell-library/tor-browser.sh
15 locales_for_lang() {
16 local locale="$1"
17 local langpacks
19 find "${TBB_EXT}" -maxdepth 1 -type f -name 'langpack-*@firefox.mozilla.org.xpi' -printf "%P\n" |
20 sed -n -e "s/^langpack-\($locale\)\(-[A-Z]\+\)\?@firefox.mozilla.org.xpi/\1\2/p"
23 for LANGUAGE in $(find /usr/share/amnesia/browser/searchplugins/locale -maxdepth 1 -type d -printf "%P\n"); do
24 LOCALES="$(locales_for_lang "$LANGUAGE")"
25 if [ -z "$LOCALES" ]; then
26 echo "Unable to find a matching locale for $LANGUAGE." >&2
27 exit 1
29 for LOCALE in $LOCALES; do
30 mkdir -p "${TBB_INSTALL}"/distribution/searchplugins/locale/$LOCALE
31 for SEARCHPLUGIN in $(find "/usr/share/amnesia/browser/searchplugins/locale/$LANGUAGE" -maxdepth 1 -type f); do
32 ln -s "$SEARCHPLUGIN" "${TBB_INSTALL}"/distribution/searchplugins/locale/$LOCALE
33 done
34 done
35 done