blob: 5fab9b824c0aa7059a01af7ce6d71f8e0d1a4d40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/bin/sh
set -e
LOCALEGEN=/etc/locale.gen
LOCALES=/usr/share/i18n/locales
if [ -n "$POSIXLY_CORRECT" ]; then
unset POSIXLY_CORRECT
fi
[ -f $LOCALEGEN ] || exit 0;
[ -s $LOCALEGEN ] || exit 0;
umask 022
is_entry_ok() {
if [ -n "$locale" -a -n "$charset" ] ; then
true
else
echo "error: Bad entry '$locale $charset'"
false
fi
}
echo "Generating locales (this might take a while)..."
rm -rf /usr/lib/locale/* 2>/dev/null
while read locale charset; do
case $locale in
\#*) continue;;
"") continue;;
esac
is_entry_ok || continue
if [ "$KEEP" ] && PERL_BADLANG=0 perl -MPOSIX -e \
'exit 1 unless setlocale(LC_ALL, $ARGV[0])' "$locale"; then
continue
fi
echo -n " `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"
echo -n ".$charset"
echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`
echo -n '...'
localedef -i $LOCALES/$locale.src -f $LOCALES/$charset.cm \
/usr/lib/locale/$locale || :
echo ' done'
done < $LOCALEGEN
echo "Generation complete."
|