2014-08-30 18:45:08 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
XPID=
|
2016-01-05 15:46:43 +00:00
|
|
|
FPID=
|
2014-08-30 18:45:08 +00:00
|
|
|
function create_fake_x ( )
|
|
|
|
{
|
2014-08-30 18:53:35 +00:00
|
|
|
export DISPLAY=":$1"
|
2014-08-30 18:45:08 +00:00
|
|
|
echo "Starting fake X: ${DISPLAY}"
|
2016-06-02 06:39:40 +00:00
|
|
|
Xvfb +extension XINERAMA +xinerama -screen 0 1280x1024x24 -screen 1 800x600x24 ${DISPLAY} &
|
2014-08-30 18:45:08 +00:00
|
|
|
XPID=$!
|
2016-01-07 20:27:20 +00:00
|
|
|
sleep 1;
|
2016-01-08 22:15:28 +00:00
|
|
|
timeout -k 30s 30s fluxbox &
|
2016-01-05 15:46:43 +00:00
|
|
|
FPID=$!
|
2014-08-30 18:45:08 +00:00
|
|
|
sleep 1
|
|
|
|
}
|
|
|
|
|
|
|
|
function destroy_fake_x ( )
|
|
|
|
{
|
|
|
|
if [ -n "${XPID}" ]
|
|
|
|
then
|
2016-01-05 15:46:43 +00:00
|
|
|
echo "Stopping fake X: ${XPID} - ${FPID}"
|
|
|
|
kill ${FPID}
|
2016-01-08 21:17:00 +00:00
|
|
|
echo " wait flux"
|
2016-01-05 15:46:43 +00:00
|
|
|
wait ${FPID}
|
2014-08-30 18:45:08 +00:00
|
|
|
kill ${XPID}
|
2016-01-08 21:17:00 +00:00
|
|
|
echo "wait x"
|
2014-08-30 18:45:08 +00:00
|
|
|
wait ${XPID}
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -n "$3" ]
|
|
|
|
then
|
2014-08-30 18:53:35 +00:00
|
|
|
export PATH=$3:$PATH
|
2014-08-30 18:45:08 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
create_fake_x "$1"
|
2014-08-30 18:53:35 +00:00
|
|
|
echo "$DISPLAY"
|
2015-12-31 22:02:13 +00:00
|
|
|
$2 $4
|
2014-08-30 18:45:08 +00:00
|
|
|
RES=$?
|
|
|
|
|
|
|
|
destroy_fake_x
|
|
|
|
|
|
|
|
exit ${RES}
|