2010-02-08 08:28:58 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
LOCALEGEN=/etc/locale.gen
|
|
|
|
LOCALES=/usr/share/i18n/locales
|
2014-02-14 13:38:54 +00:00
|
|
|
if [ -n "$POSIXLY_CORRECT" ]; then
|
|
|
|
unset POSIXLY_CORRECT
|
|
|
|
fi
|
2010-02-08 08:28:58 +00:00
|
|
|
|
2014-02-14 13:38:54 +00:00
|
|
|
|
|
|
|
[ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0;
|
2010-02-08 08:28:58 +00:00
|
|
|
|
|
|
|
# Remove all old locale dir and locale-archive before generating new
|
|
|
|
# locale data.
|
2014-02-14 13:38:54 +00:00
|
|
|
rm -rf /usr/lib/locale/* || true
|
2010-02-08 08:28:58 +00:00
|
|
|
|
|
|
|
umask 022
|
|
|
|
|
2014-02-14 13:38:54 +00:00
|
|
|
is_entry_ok() {
|
|
|
|
if [ -n "$locale" -a -n "$charset" ] ; then
|
|
|
|
true
|
|
|
|
else
|
|
|
|
echo "error: Bad entry '$locale $charset'"
|
|
|
|
false
|
|
|
|
fi
|
2010-02-08 08:28:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
echo "Generating locales..."
|
|
|
|
while read locale charset; do \
|
2014-02-14 13:38:54 +00:00
|
|
|
case $locale in \#*) continue;; "") continue;; esac; \
|
|
|
|
is_entry_ok || continue
|
|
|
|
echo -n " `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \
|
|
|
|
echo -n ".$charset"; \
|
|
|
|
echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
|
|
|
|
echo -n '...'; \
|
|
|
|
if [ -f $LOCALES/$locale ]; then input=$locale; else \
|
|
|
|
input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; fi; \
|
|
|
|
localedef -i $input -c -f $charset -A /usr/share/locale/locale.alias $locale; \
|
|
|
|
echo ' done'; \
|
2010-02-08 08:28:58 +00:00
|
|
|
done < $LOCALEGEN
|
|
|
|
echo "Generation complete."
|