mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-02 05:17:03 +08:00
[docker] make it possible to disable X server access. (#2679)
This commit is contained in:
+18
-15
@@ -13,6 +13,7 @@ fi
|
|||||||
# check if running on Linux or OSX
|
# check if running on Linux or OSX
|
||||||
UNAME=$(uname -s)
|
UNAME=$(uname -s)
|
||||||
|
|
||||||
|
useX="${useX:-true}"
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# share this paparazzi directory with the container
|
# share this paparazzi directory with the container
|
||||||
@@ -40,24 +41,26 @@ SHARE_PAPARAZZI_HOME_OPTS="--volume=$PAPARAZZI_SRC:$PPRZ_HOME_CONTAINER \
|
|||||||
############################################################
|
############################################################
|
||||||
# grant access to X-Server
|
# grant access to X-Server
|
||||||
############################################################
|
############################################################
|
||||||
if [ $UNAME == "Linux" ]; then
|
if [ $useX = "true" ]
|
||||||
XSOCK=/tmp/.X11-unix
|
then
|
||||||
XAUTH=/tmp/.docker.xauth
|
if [ $UNAME == "Linux" ]; then
|
||||||
touch $XAUTH
|
XSOCK=/tmp/.X11-unix
|
||||||
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
|
XAUTH=/tmp/.docker.xauth
|
||||||
|
touch $XAUTH
|
||||||
|
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
|
||||||
|
|
||||||
# options to grant access to the Xserver
|
# options to grant access to the Xserver
|
||||||
X_WINDOW_OPTS="--volume=$XSOCK:$XSOCK --volume=$XAUTH:$XAUTH --env=XAUTHORITY=${XAUTH} --env=DISPLAY=${DISPLAY}"
|
X_WINDOW_OPTS="--volume=$XSOCK:$XSOCK --volume=$XAUTH:$XAUTH --env=XAUTHORITY=${XAUTH} --env=DISPLAY=${DISPLAY}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# using xauth with docker on OSX doesn't work, so we use socat:
|
||||||
|
# see https://github.com/docker/docker/issues/8710
|
||||||
|
if [ $UNAME == "Darwin" ]; then
|
||||||
|
X_WINDOW_OPTS="--env=DISPLAY=192.168.99.1:0"
|
||||||
|
TCPPROXY="socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# using xauth with docker on OSX doesn't work, so we use socat:
|
|
||||||
# see https://github.com/docker/docker/issues/8710
|
|
||||||
if [ $UNAME == "Darwin" ]; then
|
|
||||||
X_WINDOW_OPTS="--env=DISPLAY=192.168.99.1:0"
|
|
||||||
TCPPROXY="socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# Audio
|
# Audio
|
||||||
############################################################
|
############################################################
|
||||||
|
|||||||
Reference in New Issue
Block a user