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
This commit is contained in:
Henrik Levkowetz 2020-11-14 05:16:08 +00:00
parent d8052e2b9e
commit e9e2ef7bdf

View file

@ -112,11 +112,12 @@ echo "Activating the virtual python environment ..."
if ! $VIRTDIR/bin/python -c "import django"; then if ! $VIRTDIR/bin/python -c "import django"; then
echo "Installing requirements ..." echo "Installing requirements ..."
if [ ! -f /home/$USER/$CWD/requirements.txt ]; then reqs=/home/$USER/$CWD/requirements.txt
echo " Using /home/$USER/$CWD/requirements.txt" if [ ! -f $reqs ]; then
pip install -r /home/$USER/$CWD/requirements.txt echo " Using $reqs"
pip install -r $reqs
else else
echo " Didn't find /home/$USER/$CWD/requirements.txt" echo " Didn't find $reqs"
echo " Using /usr/local/share/datatracker/requirements.txt" echo " Using /usr/local/share/datatracker/requirements.txt"
pip install -r /usr/local/share/datatracker/requirements.txt pip install -r /usr/local/share/datatracker/requirements.txt
fi 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/" cd "/home/$USER/$CWD" || cd "/home/$USER/"
echo "Done!" echo "Done!"
echo "" if ! echo "$LANG" | grep "UTF-8"; then
echo "Make sure you export LANG=en_GB.UTF-8 (or another UTF-8 locale) in your .bashrc" 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