summaryrefslogtreecommitdiff
path: root/packaging/locales-init.spec
blob: 40bd3c8589859fd0866548d8cf3b07aa6ab68b33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Name:       locales-init
Summary:    Locales selection for Tizen platforms
Version:    0.8
Release:    3
Group:      System/Libraries
License:    Apache License, Version 2.0
Source1001: locales-init.manifest

%description
Locales selection for Tizen platforms

%build
cp %{SOURCE1001} .
echo "generating locales.."

%post
TMP="`tempfile`"
LOCALE_REGEXP="(de_DE|el_GR|en_US|es_ES|fr_FR|it_IT|ja_JP|ko_KR|nl_NL|pt_PT|ru_RU|tr_TR|zh_CN|zh_HK|zh_TW).*UTF-8"

egrep -v '^(#|$)' /etc/locale.gen |
egrep -v "^ *$LOCALE_REGEXP" |
while read line
  do
     echo Disabling locale `echo $line | cut -d' ' -f1` 1>&2
     echo "-e 's|^$line\$|# $line|'"
  done |
xargs sed /etc/locale.gen -r -e '' >"$TMP"
cat "$TMP" >/etc/locale.gen

egrep "^# *$LOCALE_REGEXP" /etc/locale.gen |
sed 's/^# *//' |
while read line
 do
     echo Enabling locale `echo $line | cut -d' ' -f1` 1>&2
     echo "-e 's|^# *$line\$|$line|'"
 done |
xargs sed /etc/locale.gen -r -e '' >"$TMP"
cat "$TMP" >/etc/locale.gen
rm "$TMP"

locale-gen

%files
%manifest locales-init.manifest