Merge remote-tracking branch 'origin/feature/7705-smaller-squashfs' into stable
[tails/pzajda.git] / config / chroot_local-hooks / 14-add_localized_iceweasel_searchplugins
blob46df1c6cbc7beb8d07eea1f6a86a303c958ffb4b
1 #!/bin/sh
3 set -e
5 echo "Setting up localized iceweasel search plugins"
7 # Link localized Tails searchplugins to the proper localization directories:
8 # e.g. files in '/usr/share/amnesia/iceweasel/searchplugins/locale/es' will be
9 # linked in '/etc/iceweasel/searchplugins/locale/es-AR',
10 # '/etc/iceweasel/searchplugins/locale/es-ES', etc.
12 locales_for_lang() {
13 local locale="$1"
14 local langpacks
16 find /usr/lib/iceweasel/browser/extensions -maxdepth 1 -type f -name 'langpack-*@iceweasel.mozilla.org.xpi' -printf "%P\n" |
17 sed -n -e "s/^langpack-\($locale\)\(-[A-Z]\+\)\?@iceweasel.mozilla.org.xpi/\1\2/p"
20 for LANGUAGE in $(find /usr/share/amnesia/iceweasel/searchplugins/locale -maxdepth 1 -type d -printf "%P\n"); do
21 LOCALES="$(locales_for_lang "$LANGUAGE")"
22 if [ -z "$LOCALES" ]; then
23 echo "Unable to find a matching locale for $LANGUAGE." >&2
24 exit 1
26 for LOCALE in $LOCALES; do
27 mkdir -p /etc/iceweasel/searchplugins/locale/$LOCALE
28 for SEARCHPLUGIN in $(find "/usr/share/amnesia/iceweasel/searchplugins/locale/$LANGUAGE" -maxdepth 1 -type f); do
29 ln -s "$SEARCHPLUGIN" /etc/iceweasel/searchplugins/locale/$LOCALE
30 done
31 done
32 done