/[packages]/cauldron/locales/current/SOURCES/locale_install.sh
ViewVC logotype

Contents of /cauldron/locales/current/SOURCES/locale_install.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1150699 - (show annotations) (download) (as text)
Sat Sep 2 11:41:02 2017 UTC (6 years, 7 months ago) by tv
File MIME type: application/x-sh
File size: 1715 byte(s)
- fix file list (en_BE is dead + some other dead files)
- stop removing remove encoding files used by locales from /etc/locale
  (locale_install.sh doesn't copy those anymore)

1 #!/bin/bash
2
3 # this script is to be called when a locale is installed for first time;
4 # it gets the locale name(s) as parameter, and does the needed steps
5 # so that the new locale can be used by the system
6
7 # the list of languages that rpm installs their translations
8 if [ -r /etc/rpm/macros ]; then
9 RPM_INSTALL_LANG="`grep '^%_install_langs' /etc/rpm/macros | cut -d' ' -f2-`"
10 fi
11 [ -z "$RPM_INSTALL_LANG" ] && RPM_INSTALL_LANG=C
12 OLD_RPM_INSTALL_LANG="$RPM_INSTALL_LANG"
13
14 # remove/update locale-archive based on system wide configuration
15 [ -r /etc/sysconfig/locales ] && . /etc/sysconfig/locales
16 case "$USE_LOCARCHIVE" in
17 yes|true|1)
18 update_locarchive=1
19 ;;
20 *)
21 update_locarchive=0
22 rm -f /usr/share/locale/locale-archive
23 ;;
24 esac
25
26 for i in "$@"; do
27 langs="$i"
28 for j in /usr/share/locale/$i.*; do
29 [ -d "$j" ] || continue
30 lng=`basename $j`
31 # sanity check
32 echo $lng | grep -q $i || continue
33 langs="$langs $lng"
34 done
35 for k in $langs; do
36 if [ -r "/usr/share/locale/$k/LC_CTYPE" ]; then
37 # maintain updated locale-archive file
38 [ "$update_locarchive" -eq 0 ] || \
39 localedef \
40 --replace \
41 --add-to-archive "/usr/share/locale/$k" \
42 > /dev/null
43 fi
44 done
45
46 # make the installed locale known to rpm (so translations in that
47 # language are installed), and the menu system
48 if [ "$RPM_INSTALL_LANG" != "all" ]; then
49 RPM_INSTALL_LANG=`perl -e 'print join(":",grep { ! $seen{$_} ++ } sort(split(/:/,$ARGV[0])))' "$i:$RPM_INSTALL_LANG"`
50 fi
51 done
52
53 if [ "$OLD_RPM_INSTALL_LANG" != "$RPM_INSTALL_LANG" ]; then
54 # update /etc/rpm/macros file
55 if [ -w /etc/rpm/macros ]; then
56 perl -pe "s/^%_install_langs .*/%_install_langs ${RPM_INSTALL_LANG}/" \
57 -i /etc/rpm/macros
58 fi
59 fi

Properties

Name Value
svn:eol-style native
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.30