upgpkg: sbcl 2.3.1-1
[arch-packages.git] / glibc / trunk / locale-gen
blobee88880705a5c4bd1ad0e956808c62322c9330dc
1 #!/bin/sh
3 set -e
5 LOCALEGEN=/etc/locale.gen
6 LOCALES=/usr/share/i18n/locales
7 if [ -n "$POSIXLY_CORRECT" ]; then
8 unset POSIXLY_CORRECT
9 fi
12 [ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0;
14 # Remove all old locale dir and locale-archive before generating new
15 # locale data.
16 rm -rf /usr/lib/locale/locale-archive || true
18 umask 022
20 is_entry_ok() {
21 if [ -n "$locale" -a -n "$charset" ] ; then
22 true
23 else
24 echo "error: Bad entry '$locale $charset'"
25 false
29 echo "Generating locales..."
30 while read locale charset; do \
31 case $locale in \#*) continue;; "") continue;; esac; \
32 is_entry_ok || continue
33 echo -n " `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \
34 echo -n ".$charset"; \
35 echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
36 echo -n '...'; \
37 if [ -f $LOCALES/$locale ]; then input=$locale; else \
38 input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; fi; \
39 localedef -i $input -c -f $charset -A /usr/share/locale/locale.alias $locale; \
40 echo ' done'; \
41 done < $LOCALEGEN
42 echo "Generation complete."