Commit ba33669a authored by h8h's avatar h8h Committed by Joshua Tauberer

generate the locales before change to it.

For my german box changing the locale failed:
´´´´/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
setup/functions.sh: line 6: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)´´´´

see #206 and 4e6d572d
closes #220
commit modified by joshdata
parent 779d9214
...@@ -28,7 +28,8 @@ EXEC_AS_USER=root ...@@ -28,7 +28,8 @@ EXEC_AS_USER=root
# Ensure Python reads/writes files in UTF-8. If the machine # Ensure Python reads/writes files in UTF-8. If the machine
# triggers some other locale in Python, like ASCII encoding, # triggers some other locale in Python, like ASCII encoding,
# Python may not be able to read/write files. Here and in # Python may not be able to read/write files. Here and in
# setup/functions.sh. # setup/start.sh (where the locale is also installed if not
# already present).
export LANGUAGE=en_US.UTF-8 export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8 export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8 export LANG=en_US.UTF-8
......
# Ensure Python reads/writes files in UTF-8. If the machine
# triggers some other locale in Python, like ASCII encoding,
# Python may not be able to read/write files. Here and in
# the management daemon startup script.
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8
function hide_output { function hide_output {
# This function hides the output of a command unless the command fails # This function hides the output of a command unless the command fails
# and returns a non-zero exit code. # and returns a non-zero exit code.
......
...@@ -8,6 +8,21 @@ source setup/functions.sh # load our functions ...@@ -8,6 +8,21 @@ source setup/functions.sh # load our functions
# machine with enough memory? If not, this shows an error and exits. # machine with enough memory? If not, this shows an error and exits.
. setup/preflight.sh . setup/preflight.sh
# Ensure Python reads/writes files in UTF-8. If the machine
# triggers some other locale in Python, like ASCII encoding,
# Python may not be able to read/write files. Here and in
# the management daemon startup script.
if [ -z `locale -a | grep en_US.utf8` ]; then
# Generate locale if not exists
hide_output locale-gen en_US.UTF-8
fi
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8
# Recall the last settings used if we're running this a second time. # Recall the last settings used if we're running this a second time.
if [ -f /etc/mailinabox.conf ]; then if [ -f /etc/mailinabox.conf ]; then
# Run any system migrations before proceeding. Since this is a second run, # Run any system migrations before proceeding. Since this is a second run,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment