chore: import upstream snapshot with attribution
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
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
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
# Unified launcher for turtlesim - auto-detects OS and runs appropriate script
|
||||
|
||||
set -e
|
||||
|
||||
# Detect operating system
|
||||
OS_TYPE=$(uname -s)
|
||||
|
||||
case "$OS_TYPE" in
|
||||
Darwin*)
|
||||
echo "Detected macOS - launching with XQuartz support..."
|
||||
./scripts/launch_macos.sh
|
||||
;;
|
||||
Linux*)
|
||||
echo "Detected Linux - launching with X11 support..."
|
||||
./scripts/launch_linux.sh
|
||||
;;
|
||||
MINGW*|MSYS*|CYGWIN*)
|
||||
echo "Detected Windows - launching with X server support..."
|
||||
./scripts/launch_windows.sh
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported OS: $OS_TYPE"
|
||||
echo " Please run the appropriate script manually:"
|
||||
echo " - macOS: ./scripts/launch_macos.sh"
|
||||
echo " - Linux: ./scripts/launch_linux.sh"
|
||||
echo " - Windows: ./scripts/launch_windows.sh"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
#!/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."
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
#!/bin/bash
|
||||
# Simple macOS startup script for turtlesim GUI
|
||||
# This script handles all the X11 forwarding complexity automatically
|
||||
|
||||
set -e
|
||||
|
||||
echo "Starting Turtlesim on macOS with GUI"
|
||||
echo "========================================"
|
||||
|
||||
# Function to detect display number
|
||||
detect_display() {
|
||||
if pgrep -f "Xquartz :1" > /dev/null; then
|
||||
echo "1"
|
||||
elif pgrep -f "Xquartz :0" > /dev/null; then
|
||||
echo "0"
|
||||
else
|
||||
echo "0" # Default fallback
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to get machine IP
|
||||
get_machine_ip() {
|
||||
# Try en0 first (most common)
|
||||
local ip=$(ifconfig en0 2>/dev/null | grep 'inet ' | awk '{print $2}' | head -n1)
|
||||
|
||||
# If en0 doesn't work, try other interfaces
|
||||
if [[ -z "$ip" ]]; then
|
||||
ip=$(ifconfig 2>/dev/null | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | head -n1)
|
||||
fi
|
||||
|
||||
echo "$ip"
|
||||
}
|
||||
|
||||
# Step 1: Start XQuartz if not running
|
||||
if ! pgrep -x "X11.bin" > /dev/null; then
|
||||
echo "Starting XQuartz..."
|
||||
open -a XQuartz
|
||||
|
||||
# Wait for XQuartz to start (up to 10 seconds)
|
||||
for i in {1..10}; do
|
||||
if pgrep -x "X11.bin" > /dev/null; then
|
||||
echo "XQuartz started"
|
||||
break
|
||||
fi
|
||||
echo " Waiting for XQuartz... ($i/10)"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if ! pgrep -x "X11.bin" > /dev/null; then
|
||||
echo "ERROR: XQuartz failed to start. Please start it manually."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "XQuartz already running"
|
||||
fi
|
||||
|
||||
# Step 2: Detect display number and machine IP
|
||||
DISPLAY_NUM=$(detect_display)
|
||||
MACHINE_IP=$(get_machine_ip)
|
||||
|
||||
if [[ -z "$MACHINE_IP" ]]; then
|
||||
echo "ERROR: Could not detect machine IP address"
|
||||
echo "Please run: ifconfig en0 | grep inet"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Display detected: :$DISPLAY_NUM"
|
||||
echo "Machine IP: $MACHINE_IP"
|
||||
|
||||
# Step 3: Set up X11 permissions
|
||||
export DISPLAY=:$DISPLAY_NUM
|
||||
if command -v xhost >/dev/null 2>&1; then
|
||||
echo "Allowing X11 connections..."
|
||||
xhost + >/dev/null 2>&1 || echo "WARNING: xhost command failed, but continuing..."
|
||||
else
|
||||
echo "WARNING: xhost not found - X11 forwarding may not work"
|
||||
fi
|
||||
|
||||
# Step 4: Export DISPLAY for Docker
|
||||
export DISPLAY="$MACHINE_IP:$DISPLAY_NUM"
|
||||
echo "Docker will use DISPLAY=$DISPLAY"
|
||||
|
||||
# Step 5: 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."
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
# Windows (WSL/Git Bash) startup script for turtlesim GUI
|
||||
# Requires an X server like VcXsrv, X410, or Xming running on Windows
|
||||
|
||||
set -e
|
||||
|
||||
echo "Starting Turtlesim on Windows with GUI"
|
||||
echo "=========================================="
|
||||
|
||||
# Step 1: Check if running in WSL or Git Bash
|
||||
if grep -qi microsoft /proc/version 2>/dev/null; then
|
||||
PLATFORM="WSL"
|
||||
elif uname -s | grep -qi "MINGW\|MSYS\|CYGWIN"; then
|
||||
PLATFORM="Git Bash/MSYS"
|
||||
else
|
||||
PLATFORM="Unknown"
|
||||
fi
|
||||
|
||||
echo "Detected platform: $PLATFORM"
|
||||
|
||||
# Step 2: Check if X server is running on Windows
|
||||
echo "Checking for X server on Windows..."
|
||||
echo " Make sure VcXsrv, X410, or another X server is running!"
|
||||
echo " If not installed, get VcXsrv from: https://sourceforge.net/projects/vcxsrv/"
|
||||
|
||||
# Step 3: Set DISPLAY for Docker
|
||||
# Docker Desktop on Windows uses host.docker.internal to reach Windows host
|
||||
export DISPLAY="host.docker.internal:0.0"
|
||||
echo "Docker will use DISPLAY=$DISPLAY"
|
||||
|
||||
# Step 4: Warn about common issues
|
||||
cat << 'TIPS'
|
||||
|
||||
Important Notes for Windows:
|
||||
- Start your X server (VcXsrv/X410) BEFORE running this script
|
||||
- In VcXsrv: disable "Native opengl" and enable "Disable access control"
|
||||
- If GUI doesn't appear, check Windows Firewall settings
|
||||
- Docker Desktop must be running
|
||||
|
||||
TIPS
|
||||
|
||||
# Step 5: 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 appear in your X server."
|
||||
Reference in New Issue
Block a user