OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.6 KiB

  1. #!/bin/sh
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: package/.../glibc/locale-gen
  6. # Copyright (C) 2016 The OpenSDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. set -e
  16. LOCALEGEN=/etc/locale.gen
  17. LOCALES=/usr/share/i18n/locales
  18. if [ -n "$POSIXLY_CORRECT" ]; then
  19. unset POSIXLY_CORRECT
  20. fi
  21. [ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0;
  22. # Remove all old locale dir and locale-archive before generating new
  23. # locale data.
  24. rm -rf /usr/lib/locale/* || true
  25. umask 022
  26. is_entry_ok() {
  27. if [ -n "$locale" -a -n "$charset" ] ; then
  28. true
  29. else
  30. echo "error: Bad entry '$locale $charset'"
  31. false
  32. fi
  33. }
  34. echo "Generating locales..."
  35. while read locale charset; do \
  36. case $locale in \#*) continue;; "") continue;; esac; \
  37. is_entry_ok || continue
  38. echo -n " `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \
  39. echo -n ".$charset"; \
  40. echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
  41. echo -n '...'; \
  42. if [ -f $LOCALES/$locale ]; then input=$locale; else \
  43. input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; fi; \
  44. localedef -i $input -c -f $charset -A /usr/share/locale/locale.alias $locale; \
  45. echo ' done'; \
  46. done < $LOCALEGEN
  47. echo "Generation complete."