~ubuntu-branches/ubuntu/jaunty/belocs-locales-data/jaunty

« back to all changes in this revision

Viewing changes to debian/postinst

  • Committer: Bazaar Package Importer
  • Author(s): Denis Barbier
  • Date: 2006-06-08 22:00:09 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060608220009-xbiuiampv18ok4u9
Tags: 2.4-2
* Modified patches:
  + bz672_include_iso14651_t1_LC_COLLATE.diff
  + include_iso14651_t1_others.diff
    Fix <MIN> and <CAP> collation for several locales.  This is needed so
    that character ranges work as expected, see #362514 for instance.

* New patches:
  + fix_ro_RO_mincap.diff
  + fix_se_NO_mincap.diff
    Some fixes for <MIN> and <CAP> collation.

* Move locale selection from belocs-locales-data into belocs-locales-bin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh
2
 
set -e
3
 
 
4
 
#  If locale-gen is not present, do nothing
5
 
[ -x /usr/sbin/locale-gen ] || exit 0
6
 
 
7
 
LG="/etc/locale.gen"
8
 
EE="/etc/environment"
9
 
 
10
 
if [ "$1" = configure ]; then
11
 
 
12
 
    . /usr/share/debconf/confmodule
13
 
    db_version 2.0
14
 
 
15
 
    db_get belocs-locales-data/locales_to_be_generated && SELECTED_LOCALES=$RET
16
 
    db_get belocs-locales-data/default_environment_locale && SELECTED="$RET"
17
 
 
18
 
    if [ -n "$SELECTED_LOCALES" ]; then
19
 
        if [ -e $LG ]; then
20
 
            #   Comment previous defined locales
21
 
            LC_ALL=C sed -e 's/^[a-zA-Z]/#&/' $LG > $LG.tmp || true
22
 
            mv -f $LG.tmp $LG
23
 
            last=`tail -n 1 "$LG"`
24
 
            if test -n "$last"; then echo >> $LG; fi
25
 
        else
26
 
            cat > $LG << EOF
27
 
# This file lists locales that you wish to have built. You can find a list
28
 
# of valid supported locales at /usr/share/i18n/SUPPORTED. Other
29
 
# combinations are possible, but may not be well tested. If you change
30
 
# this file, you need to rerun locale-gen.
31
 
#
32
 
 
33
 
EOF
34
 
        fi
35
 
        list=`echo $SELECTED_LOCALES | sed -e 's/, /,/g'`
36
 
        save_IFS=$IFS
37
 
        IFS=,
38
 
        for locale in $list; do
39
 
            if grep -q "^$locale *\$" $LG; then
40
 
                #   This locale has already been inserted, do nothing
41
 
                :
42
 
            elif grep -q "^#$locale *\$" $LG; then
43
 
                #   Uncomment previous defined locales
44
 
                sed -e "s,#$locale *\$,$locale," $LG > $LG.tmp || true
45
 
                mv -f $LG.tmp $LG
46
 
            else
47
 
                #   Add a new locale
48
 
                echo $locale >> $LG
49
 
            fi
50
 
        done
51
 
        IFS=$save_IFS
52
 
    else
53
 
        if [ -e $LG ]; then
54
 
            LC_ALL=C sed -e 's/^[a-zA-Z]/#&/' $LG > $LG.tmp || true
55
 
            mv -f $LG.tmp $LG
56
 
        fi
57
 
    fi
58
 
    # Update requested locales.
59
 
    /usr/sbin/locale-gen
60
 
 
61
 
    # Set default LANG environment variable
62
 
    if [ -e $EE ]; then
63
 
        sed -e '/^ *LANG=/d' $EE > $EE.tmp || true
64
 
        #  $EE has to be updated if $SELECTED is empty or 'None'
65
 
        cp -f $EE.tmp $EE
66
 
    else
67
 
        :> $EE.tmp
68
 
    fi
69
 
    if [ -n "$SELECTED" ] && [ "$SELECTED" != "None" ]; then
70
 
        #   Add a newline in case last line does not have one
71
 
        echo >> $EE.tmp
72
 
        echo "LANG=$SELECTED" >> $EE.tmp
73
 
        #   Consecutive blank lines are replaced by a single line
74
 
        cat -s $EE.tmp > $EE
75
 
    fi
76
 
    rm -f $EE.tmp
77
 
fi
78
 
 
79
 
#DEBHELPER#
80