Merge branch 'master' of git://git.tails.boum.org/tails
[besstails.git] / config / chroot_local-hooks / 14-add_localized_iceweasel_searchplugins
blob671ce8dce4d107978430ba08af6e68b278d0194b
1 #!/bin/sh
3 set -e
5 # Link localized Tails searchplugins to the proper localization directories:
6 # e.g. files in '/usr/share/amnesia/iceweasel/searchplugins/locale/es' will be
7 # linked in '/etc/iceweasel/searchplugins/locale/es-AR',
8 # '/etc/iceweasel/searchplugins/locale/es-ES', etc.
10 locales_for_lang() {
11 local locale="$1"
12 local langpacks
14 find /usr/lib/iceweasel/extensions -maxdepth 1 -type f -name 'langpack-*@iceweasel.mozilla.org.xpi' -printf "%P\n" |
15 sed -n -e "s/^langpack-\($locale\)\(-[A-Z]\+\)\?@iceweasel.mozilla.org.xpi/\1\2/p"
18 for LANGUAGE in $(find /usr/share/amnesia/iceweasel/searchplugins/locale -maxdepth 1 -type d -printf "%P\n"); do
19 LOCALES="$(locales_for_lang "$LANGUAGE")"
20 if [ -z "$LOCALES" ]; then
21 echo "Unable to find a matching locale for $LANGUAGE." >&2
22 exit 1
24 for LOCALE in $LOCALES; do
25 mkdir -p /etc/iceweasel/searchplugins/locale/$LOCALE
26 for SEARCHPLUGIN in $(find "/usr/share/amnesia/iceweasel/searchplugins/locale/$LANGUAGE" -maxdepth 1 -type f); do
27 ln -s "$SEARCHPLUGIN" /etc/iceweasel/searchplugins/locale/$LOCALE
28 done
29 done
30 done