/ scripts / run-dev.sh
run-dev.sh
 1  #!/bin/bash
 2  # Combined development environment: Go server + QEMU + packet capture in tmux
 3  # Usage: ./scripts/run-dev.sh
 4  #
 5  # Layout:
 6  # ┌─────────────────────────────────────┐
 7  # │  Go libp2p Server                   │
 8  # ├──────────────────┬──────────────────┤
 9  # │  QEMU UEFI       │  tshark capture  │
10  # └──────────────────┴──────────────────┘
11  
12  set -e
13  
14  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
15  PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
16  SESSION="libp2p-dev"
17  
18  # Kill existing session if present
19  tmux kill-session -t "$SESSION" 2>/dev/null || true
20  
21  # Create new tmux session with the Go server in the first pane (top, full width)
22  tmux new-session -d -s "$SESSION" -c "$PROJECT_DIR/test-server" \
23      "echo '=== Go libp2p Server ===' && SSLKEYLOGFILE=/tmp/quic-keys.log go run main.go; read -p 'Press Enter to exit...'"
24  
25  # Split horizontally for bottom row
26  tmux split-window -v -t "$SESSION" -c "$PROJECT_DIR" \
27      "echo '=== QEMU UEFI ===' && sleep 2 && $SCRIPT_DIR/run-qemu.sh; read -p 'Press Enter to exit...'"
28  
29  # Split the bottom pane vertically for packet capture
30  # Use tcpdump since tshark has broken deps on this system
31  tmux split-window -h -t "$SESSION":0.1 -c "$PROJECT_DIR" \
32      "echo '=== Packet Capture (UDP 4001) ===' && echo 'Waiting for traffic...' && tcpdump -i any udp port 4001 -X -v; read -p 'Press Enter to exit...'"
33  
34  # Select the QEMU pane (bottom left)
35  tmux select-pane -t "$SESSION":0.1
36  
37  # Attach to the session
38  tmux attach -t "$SESSION"