Skip to content

Commit c0e3a6b

Browse files
committed
Use a sourced environment file for root env variables instead of inline assignment
1 parent 5d91a00 commit c0e3a6b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

StandaloneDebug/entry_point.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,17 @@ rm -f /tmp/.X*lock
2020
SERVERNUM=$(get_server_num)
2121
env | cut -f 1 -d "=" | sort > asroot
2222
sudo -E -u seluser -i env | cut -f 1 -d "=" | sort > asseluser
23-
sudo -E -i -u seluser bash -c "\
24-
$(for E in $(grep -vxFf asseluser asroot); do echo $E="'$(eval echo \$$E)'"; done) \
25-
DISPLAY=$DISPLAY \
26-
xvfb-run -n $SERVERNUM --server-args=\"-screen 0 $GEOMETRY -ac +extension RANDR\" \
23+
24+
# Add root environment variables that are not present in the seluser
25+
# environment to an environment file.
26+
$(for E in $(grep -vxFf asseluser asroot); do echo $E="'${!E}'" >> ~seluser/selenv; done) \
27+
echo "DISPLAY=${DISPLAY}" >> ~seluser/selenv
28+
29+
sudo -E -i -u seluser \
30+
source selenv && \
31+
xvfb-run -n $SERVERNUM --server-args="-screen 0 $GEOMETRY -ac +extension RANDR" \
2732
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
28-
${SE_OPTS} &"
33+
${SE_OPTS} &
2934
NODE_PID=$!
3035

3136
trap shutdown SIGTERM SIGINT

0 commit comments

Comments
 (0)