db1d565b64
Integration Tests / melodic (push) Has been cancelled
Integration Tests / noetic (push) Has been cancelled
Integration Tests / humble (push) Has been cancelled
Integration Tests / jazzy (push) Has been cancelled
Ruff Lint & Format / ruff (push) Has been cancelled
Sync main to develop / Check if sync is needed (push) Has been cancelled
Sync main to develop / Sync main to develop (push) Has been cancelled
43 lines
1.1 KiB
Bash
Executable File
43 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Linux startup script for turtlesim GUI
|
|
|
|
set -e
|
|
|
|
echo "Starting Turtlesim on Linux with GUI"
|
|
echo "========================================"
|
|
|
|
# Step 1: Check if X11 is available
|
|
if [[ -z "$DISPLAY" ]]; then
|
|
echo "ERROR: DISPLAY variable not set"
|
|
echo "X11 forwarding is required. Are you running in a GUI environment?"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Using DISPLAY: $DISPLAY"
|
|
|
|
# Step 2: Allow Docker to access X11
|
|
if command -v xhost >/dev/null 2>&1; then
|
|
echo "Allowing Docker X11 access..."
|
|
xhost +local:docker >/dev/null 2>&1 || {
|
|
echo "WARNING: xhost command failed, trying without sudo..."
|
|
xhost + >/dev/null 2>&1 || echo "WARNING: Could not run xhost, X11 forwarding may not work"
|
|
}
|
|
else
|
|
echo "WARNING: xhost not found. Install with: sudo apt-get install x11-xserver-utils"
|
|
exit 1
|
|
fi
|
|
|
|
# Step 3: Export DISPLAY for Docker
|
|
echo "Docker will use DISPLAY=$DISPLAY"
|
|
|
|
# Step 4: Start the container
|
|
echo ""
|
|
echo "Starting Turtlesim container..."
|
|
echo "If successful, you should see a window with a turtle!"
|
|
echo ""
|
|
|
|
docker compose up turtlesim
|
|
|
|
echo ""
|
|
echo "Done! The turtle window should be visible on your screen."
|