6 echo "Generate supported locales"
8 LANGUAGES_FILE
="/usr/share/tails/greeter/supported_languages"
9 LANG_REGEXP
=$
(sed --regexp-extended 's, ,|,g' "$LANGUAGES_FILE" \
10 |
sed --regexp-extended 's,\|$,,')
12 # Import ensure_hook_dependency_is_installed()
13 .
/usr
/local
/lib
/tails-shell-library
/build.sh
15 # Install locales, which ships /etc/locale.gen and locale-gen
16 ensure_hook_dependency_is_installed locales
18 # Uncomment supported locales
19 perl
-pi -E "s{^#\s+((?:${LANG_REGEXP})_.*\sUTF-8)$}{\$1}" /etc
/locale.gen
24 # Installing localepurge generates an initial /etc/locale.nopurge
25 # from /etc/locale.gen
26 apt-get
--yes install localepurge
28 # Add missing variants to /etc/locale.nopurge:
29 # - ll_RR.UTF-8 → ll_RR
30 perl
-n -E 'if (m/^([a-z].*)[.]UTF-8$/) { say $1 }' \
32 > /tmp
/locale.nopurge.extra
33 # - ll_RR.UTF-8 → ll.UTF-8
34 perl
-n -E 'if (m/^([a-z]+)_.*[.]UTF-8$/) { say "$1.UTF-8" }' \
36 >> /tmp
/locale.nopurge.extra
37 # - ll_RR.UTF-8 → ll.utf8
38 perl
-n -E 'if (m/^([a-z].*)[.]UTF-8$/) { say "$1.utf8" }' \
40 >> /tmp
/locale.nopurge.extra
41 cat /tmp
/locale.nopurge.extra
>> /etc
/locale.nopurge
43 echo "I: localepurge won't purge:"
44 grep -E '^[a-z]' /etc
/locale.nopurge
46 echo "I: Running localepurge for the first time"