Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 25 additions & 15 deletions bin/install-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,32 @@ add_locale() {
echo $DONE_MSG
}

generate_locales() {
echo "Generating locales... "
# If language-pack-en is present, install that:
apt-get -qq install -y language-pack-en >/dev/null || true
add_locale en_GB
setup_locale() {
echo "Setting up locale... "
default=$(LANG="" && . /etc/default/locale && echo $LANG)
if [ x"$(LC_ALL=$LANG locale -k LC_CTYPE | grep -c 'charmap="UTF-8"')" = x1 ]; then
# Current is UTF-8, make sure it's generated and use that
add_locale $LANG
if [ $default != $lang && -n "$default" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't seen lowercase $lang defined anywhere, so not sure where that's coming from.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a typo, ta; that whole section needs work as per #24 (comment)

echo '' > /etc/default/locale
fi
elif [ x"$(LC_ALL=$default locale -k LC_CTYPE | grep -c 'charmap="UTF-8"')" = x1 ]; then
# current not UTF-8, but default is, let's use that as current
export LANG="$default"
export LC_ALL="$default"
else
# Fall back to installing and using en_GB.UTF-8
# If language-pack-en is present, install that:
apt-get -qq install -y language-pack-en >/dev/null || true
add_locale en_GB
echo 'LANG="en_GB.UTF-8"' > /etc/default/locale
echo 'LC_ALL="en_GB.UTF-8"' >> /etc/default/locale
export LANG="en_GB.UTF-8"
export LC_ALL="en_GB.UTF-8"
fi
echo $DONE_MSG
}

set_locale() {
echo 'LANG="en_GB.UTF-8"' > /etc/default/locale
echo 'LC_ALL="en_GB.UTF-8"' >> /etc/default/locale
export LANG="en_GB.UTF-8"
export LC_ALL="en_GB.UTF-8"
}

add_unix_user() {
echo -n "Adding unix user... "
# Create the required user if it doesn't already exist:
Expand Down Expand Up @@ -392,7 +403,7 @@ install_nginx() {
install_postgis() {
echo -n "Installing PostGIS... "
POSTGIS_SCRIPT='https://docs.djangoproject.com/en/dev/_downloads/create_template_postgis-debian.sh'
su -l -c "curl '$POSTGIS_SCRIPT' | bash -s" postgres
su -l -c "curl -s '$POSTGIS_SCRIPT' | bash -s >/dev/null" postgres
# According to Matthew's installation instructions, these two SRID
# may be missing the appropriate +datum from the proj4text column,
# depending on what PostGIS version is being used. Check whether
Expand Down Expand Up @@ -524,8 +535,7 @@ EOF
chmod a+rx /etc/rc.local
}

generate_locales
set_locale
setup_locale

add_unix_user

Expand Down