Skip to content

Commit

Permalink
Sanity checks on environment variables
Browse files Browse the repository at this point in the history
Signed-off-by: Gianpaolo Macario <gmacario@gmail.com>
  • Loading branch information
gmacario committed Sep 13, 2024
1 parent 64ac68a commit 8292993
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion freisa_on_mars/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ IMG_NAME=baroloteam/freisa_on_mars
# And append `_runtime`
CONTAINER_NAME="$(tr '/' '_' <<< "$IMG_NAME")"

# Sanity checks
if [ -z "$DISPLAY" ]; then
export DISPLAY=:0
echo "Warning: DISPLAY undefined, set to $DISPLAY"
fi
if [ -z "$TERM" ]; then
export TERM=xterm
echo "Warning: TERM undefined, set to $TERM"
fi
if [ -z "$XAUTHORITY" ]; then
export XAUTHORITY=~/.Xauthority
echo "Warning: XAUTHORITY undefined, set to $XAUTHORITY"
xauth extract \- $DISPLAY >>$XAUTHORITY
fi

# Start the container
#
# --rm: delete container after exiting
Expand All @@ -32,13 +47,13 @@ CONTAINER_NAME="$(tr '/' '_' <<< "$IMG_NAME")"
docker run --rm -it --name $CONTAINER_NAME \
--network host \
--volume=/tmp/.X11-unix:/tmp/.X11-unix \
--volume "$XAUTHORITY:/.Xauthority" \
--device=/dev/dri:/dev/dri \
-e DISPLAY \
-e TERM \
-e QT_X11_NO_MITSHM=1 \
-e XAUTHORITY=/.Xauthority \
$IMG_NAME

# --volume "$XAUTHORITY:/.Xauthority" \

# EOF

0 comments on commit 8292993

Please sign in to comment.