|
#!/bin/sh
|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
#
|
|
# Filename: package/.../glibc/locale-gen
|
|
# Copyright (C) 2016 The OpenSDE Project
|
|
#
|
|
# More information can be found in the files COPYING and README.
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; version 2 of the License. A copy of the
|
|
# GNU General Public License can be found in the file COPYING.
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
|
|
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."
|
|
|
|
|