diff options
author | root <root@rshg054.dnsready.net> | 2011-09-09 23:14:45 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2011-09-09 23:14:45 +0000 |
commit | 42db4a0cf3a829fcd1bc2150669c6aa3c2984815 (patch) | |
tree | 91bdb63fa6802146ab19b3fbf8f6fc5ab78e23c2 /testing/glibc/locale-gen | |
parent | a7b0a0b362d0535cd86b575a45ec70cc2332fa62 (diff) |
Fri Sep 9 23:14:45 UTC 2011
Diffstat (limited to 'testing/glibc/locale-gen')
-rwxr-xr-x | testing/glibc/locale-gen | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/testing/glibc/locale-gen b/testing/glibc/locale-gen new file mode 100755 index 000000000..5aff344c4 --- /dev/null +++ b/testing/glibc/locale-gen @@ -0,0 +1,42 @@ +#!/bin/sh + +set -e + +LOCALEGEN=/etc/locale.gen +LOCALES=/usr/share/i18n/locales +if [ -n "$POSIXLY_CORRECT" ]; then + unset POSIXLY_CORRECT +fi + + +[ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0; + +# Remove all old locale dir and locale-archive before generating new +# locale data. +rm -rf /usr/lib/locale/* || true + +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..." +while read locale charset; do \ + 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'; \ +done < $LOCALEGEN +echo "Generation complete." |