From e9e2ef7bdf02839b7b39d7d3173a4e6270440838 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Sat, 14 Nov 2020 05:16:08 +0000 Subject: [PATCH] Added propagation of the docker-init environment to the su'd user in order to set LANG to a UTF-8 locale, and did some slight refactoring. - Legacy-Id: 18692 --- docker/docker-init.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/docker/docker-init.sh b/docker/docker-init.sh index 513ced04e..7c9544a00 100644 --- a/docker/docker-init.sh +++ b/docker/docker-init.sh @@ -112,11 +112,12 @@ echo "Activating the virtual python environment ..." if ! $VIRTDIR/bin/python -c "import django"; then echo "Installing requirements ..." - if [ ! -f /home/$USER/$CWD/requirements.txt ]; then - echo " Using /home/$USER/$CWD/requirements.txt" - pip install -r /home/$USER/$CWD/requirements.txt + reqs=/home/$USER/$CWD/requirements.txt + if [ ! -f $reqs ]; then + echo " Using $reqs" + pip install -r $reqs else - echo " Didn't find /home/$USER/$CWD/requirements.txt" + echo " Didn't find $reqs" echo " Using /usr/local/share/datatracker/requirements.txt" pip install -r /usr/local/share/datatracker/requirements.txt fi @@ -180,7 +181,11 @@ chmod -R g+w /usr/local/lib/ # so we can patch libs if needed cd "/home/$USER/$CWD" || cd "/home/$USER/" echo "Done!" -echo "" -echo "Make sure you export LANG=en_GB.UTF-8 (or another UTF-8 locale) in your .bashrc" +if ! echo "$LANG" | grep "UTF-8"; then + echo "" + echo "Make sure you export LANG=en_GB.UTF-8 (or another UTF-8 locale) in your .bashrc" +else + echo "LANG=$LANG" +fi -su $USER +su -p $USER