4 # This file is generated by 'bootstrap/template.py --render'
5 # See also bootstrap/config.py
10 # refer to /usr/share/i18n/locales
12 # refer to /usr/share/i18n/charmaps
14 # locale to generate in /usr/lib/locale
15 # glibc/localedef will normalize UTF-8 to utf8, follow the naming style
16 LOCALE
=$INPUTFILE.utf8
18 # if locale is already correct, exit
19 ( locale |
grep LC_ALL |
grep -i $LOCALE ) && exit 0
21 # if locale not available, generate locale into /usr/lib/locale
22 if ! ( locale
--all-locales |
grep -i $LOCALE )
24 # no-archive means create its own dir
25 localedef
--inputfile $INPUTFILE --charmap $CHARMAP --no-archive $LOCALE
28 # update locale conf and global env file
29 # set both LC_ALL and LANG for safe
31 # update conf for Debian family
32 FILE
=/etc
/default
/locale
35 echo LC_ALL
="$LOCALE" > $FILE
36 echo LANG
="$LOCALE" >> $FILE
39 # update conf for RedHat family
43 # LC_ALL is not valid in this file, set LANG only
44 echo LANG
="$LOCALE" > $FILE
47 # update global env file
51 # append LC_ALL if not exist
52 grep LC_ALL
$FILE ||
echo LC_ALL
="$LOCALE" >> $FILE
53 # append LANG if not exist
54 grep LANG
$FILE ||
echo LANG
="$LOCALE" >> $FILE