.gitlab-ci:bootstrap: remove ubuntu1804*, add debian12, upgrade opensuse 15.5
[Samba.git] / bootstrap / generated-dists / debian11-32bit / locale.sh
blobcc64e180483896f19ce924f37e746bcd6b30614a
1 #!/bin/bash
4 # This file is generated by 'bootstrap/template.py --render'
5 # See also bootstrap/config.py
8 set -xueo pipefail
10 # refer to /usr/share/i18n/locales
11 INPUTFILE=en_US
12 # refer to /usr/share/i18n/charmaps
13 CHARMAP=UTF-8
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 )
23 then
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
33 if [ -f $FILE ]
34 then
35 echo LC_ALL="$LOCALE" > $FILE
36 echo LANG="$LOCALE" >> $FILE
39 # update conf for RedHat family
40 FILE=/etc/locale.conf
41 if [ -f $FILE ]
42 then
43 # LC_ALL is not valid in this file, set LANG only
44 echo LANG="$LOCALE" > $FILE
47 # update global env file
48 FILE=/etc/environment
49 if [ -f $FILE ]
50 then
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