Skip to content

Commit e9e2ef7

Browse files
committed
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
1 parent d8052e2 commit e9e2ef7

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

docker/docker-init.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,12 @@ echo "Activating the virtual python environment ..."
112112

113113
if ! $VIRTDIR/bin/python -c "import django"; then
114114
echo "Installing requirements ..."
115-
if [ ! -f /home/$USER/$CWD/requirements.txt ]; then
116-
echo " Using /home/$USER/$CWD/requirements.txt"
117-
pip install -r /home/$USER/$CWD/requirements.txt
115+
reqs=/home/$USER/$CWD/requirements.txt
116+
if [ ! -f $reqs ]; then
117+
echo " Using $reqs"
118+
pip install -r $reqs
118119
else
119-
echo " Didn't find /home/$USER/$CWD/requirements.txt"
120+
echo " Didn't find $reqs"
120121
echo " Using /usr/local/share/datatracker/requirements.txt"
121122
pip install -r /usr/local/share/datatracker/requirements.txt
122123
fi
@@ -180,7 +181,11 @@ chmod -R g+w /usr/local/lib/ # so we can patch libs if needed
180181
cd "/home/$USER/$CWD" || cd "/home/$USER/"
181182

182183
echo "Done!"
183-
echo ""
184-
echo "Make sure you export LANG=en_GB.UTF-8 (or another UTF-8 locale) in your .bashrc"
184+
if ! echo "$LANG" | grep "UTF-8"; then
185+
echo ""
186+
echo "Make sure you export LANG=en_GB.UTF-8 (or another UTF-8 locale) in your .bashrc"
187+
else
188+
echo "LANG=$LANG"
189+
fi
185190

186-
su $USER
191+
su -p $USER

0 commit comments

Comments
 (0)