Skip to content

Commit

Permalink
Handle environment vars. with space properly
Browse files Browse the repository at this point in the history
If you have this env. var:

no_proxy=*.local, 169.254/16

it is very hard to get the quoting correct. It is easier to just write
the correct entries to the seluser's .bash_aliases file, which will be
included by .bashrc when running xvfb-run as the seluser.
  • Loading branch information
stigkj committed Oct 19, 2016
1 parent 4f8c67d commit eaf72fb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions StandaloneDebug/entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ fi
rm -f /tmp/.X*lock

SERVERNUM=$(get_server_num)
env | cut -f 1 -d "=" | sort > asroot
sudo -E -u seluser -i env | cut -f 1 -d "=" | sort > asseluser

env | sort -k 1 -t '=' > asroot
sudo -E -u seluser -i env | sort -k 1 -t '=' > asseluser

# The .bash_aliases file will run when starting xvfb with the seluser below
join -v 1 -j 1 -t '=' --nocheck-order asroot asseluser > /home/seluser/.bash_aliases

sudo -E -i -u seluser \
$(for E in $(grep -vxFf asseluser asroot); do echo $E=$(eval echo \$$E); done) \
DISPLAY=$DISPLAY \
xvfb-run -n $SERVERNUM --server-args="-screen 0 $GEOMETRY -ac +extension RANDR" \
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
Expand Down

0 comments on commit eaf72fb

Please sign in to comment.