vp-build/srcpkgs/glibc/glibc-locales.INSTALL
2011-10-12 14:10:16 +02:00

40 lines
1.1 KiB
Plaintext

# Rebuild locales set in /etc/default/libc-locales.
#
case "${ACTION}" in
post)
LOCALE_ARCHIVEDIR=usr/lib/locale
LOCALE_ARCHIVE=${LOCALE_ARCHIVEDIR}/locale-archive
LOCALES_CONF=etc/default/libc-locales
LOCALES=usr/share/i18n/locales
LOCALE_ALIAS=usr/share/locale/locale.alias
[ -n "$POSIXLY_CORRECT" ] && unset POSIXLY_CORRECT
[ -f $LOCALE_ARCHIVE ] && rm -f $LOCALE_ARCHIVE
[ ! -d $LOCALE_ARCHIVEDIR ] && mkdir -p $LOCALE_ARCHIVEDIR
echo "Generating GNU libc locales..."
while read locale charset; do
case $locale in
\#*) continue;;
"") continue;;
esac
if [ -n "$locale" -a -n "$charset" ]; then
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 --prefix=. \
-i $input -c -f $charset -A $LOCALE_ALIAS $locale
echo ' done.'
else
echo "Ignoring wrong locale: $locale $charset..."
fi
done < $LOCALES_CONF
;;
esac