]> git.pld-linux.org Git - packages/glibc.git/commitdiff
- script to generate custom locale-archive or old-style locale dir tree
authorJakub Bogusz <qboosh@pld-linux.org>
Thu, 29 May 2003 19:40:34 +0000 (19:40 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    glibc-localedb-gen -> 1.1

glibc-localedb-gen [new file with mode: 0644]

diff --git a/glibc-localedb-gen b/glibc-localedb-gen
new file mode 100644 (file)
index 0000000..d245c5b
--- /dev/null
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+SUPPORTED_LOCALES=x
+OLD_STYLE="no"
+DESTDIR=
+
+[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
+[ -f /etc/sysconfig/localedb ] && . /etc/sysconfig/i18n
+
+LOCDIR=/usr/lib/locale
+ARCHIVE=${LOCDIR}/locale-archive
+
+while [ $# -gt 0 ]; do
+       case $1 in
+         -l=* | --locales=*)
+               SUPPORTED_LOCALES="`echo $1 | sed -e 's/^[^=]*=//'`"
+               ;;
+         -l | --locales)
+               SUPPORTED_LOCALES="$2"
+               shift
+               ;;
+         -o | --old-style)
+               OLD_STYLE="yes"
+               ;;
+         -d=* | --destdir=*)
+               DESTDIR="`echo $1 | sed -e 's/^[^]]*=//'`"
+               ;;
+         -d | --destdir)
+               DESTDIR="$2"
+               shift
+               ;;
+         -h | --help | --usage)
+               cat <<EOF
+Usage: localedb-gen [-l|--locales <locales>] [-o|--old-style]
+                    [-d|--destdir <DESTDIR>]
+       localedb-gen [-h|--help|--usage]
+EOF
+               exit
+               ;;
+         *)
+               echo "Unrecognized option: $1"
+               exit 1
+               ;;
+       esac
+       shift
+done
+
+if [ "${SUPPORTED_LOCALES}" = "x" ]; then
+       echo "SUPPORTED_LOCALES not set"
+       exit 1
+fi
+
+if [ "${DESTDIR}" = "" ] && rpm -qf ${ARCHIVE} >/dev/null 2>&1 ; then
+       echo "${ARCHIVE} belongs to `rpm -qf ${ARCHIVE}` package - uninstall it first!"
+       exit 1
+fi
+
+rm -rf ${DESTDIR}${LOCDIR}
+install -d ${DESTDIR}${LOCDIR}
+
+if [ "${DESTDIR}" = "" ]; then
+       DESTDIROPT=
+else
+       DESTDIROPT="--prefix ${DESTDIR}"
+fi
+
+for loc in ${SUPPORTED_LOCALES} ; do
+       if echo ${loc} | grep -q / ; then
+               chset="`echo ${loc} | sed -e 's@^.*/@@'`"
+               loc="`echo ${loc} | sed -e 's@/.*$@@'`"
+       elif echo ${loc} | grep -q '\.' ; then
+               chset="`echo ${loc} | sed -e 's@^.*\.@@'`"
+       elif grep -qs "^${loc}/[^ ]* .*$" /usr/share/i18n/SUPPORTED ; then
+               chset="`grep \"^${loc}/.* .*$\" /usr/share/i18n/SUPPORTED | sed -e 's@^.*/\*\([^ ]*\) .*$@\1@'`"
+       else
+               echo "Charset not known for locale ${loc} - skipping..."
+               continue
+       fi
+       echo -n "Generating ${loc} using charset ${chset}... "
+       if [ "${OLD_STYLE}" = "yes" ]; then
+               localedef -f ${chset} -i ${loc} ${DESTDIR}${LOCDIR}${loc}
+       else
+               localedef -f ${chset} -i ${loc} ${loc} ${DESTDIROPT}
+       fi
+       echo
+done
+
+echo "DONE."
This page took 0.381479 seconds and 4 git commands to generate.