fix(portability): one python/python3 note + cross-shell guidance for bash-only labs

- M1: single prominent note that the command may be python3/pip3 (modern macOS,
  default Debian/Ubuntu); referenced rather than repeated.
- Cross-shell notes where bash-only commands appear: M1 mkdir -p, M12 rm -f,
  M16 bind-mount (braced ${PWD} + PowerShell note), M19 inspect-runner.sh gains a
  timeout/gtimeout/bash-native fallback so it doesn't hang on stock macOS.

Closes #31
Closes #32

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfzV5QvtPDz8LJS3Pu5VLT
This commit is contained in:
2026-06-22 17:01:17 -04:00
parent 90012ca711
commit eed3701258
4 changed files with 40 additions and 2 deletions
@@ -15,6 +15,26 @@ set -u
line() { printf '\n=== %s ===\n' "$1"; }
# Try a TCP connect to host:port with a ~2s deadline, portably.
# GNU `timeout` (Linux) or Homebrew's `gtimeout` are used when present; otherwise a bash-native
# background-and-kill fallback keeps this working on stock macOS, which ships no GNU `timeout`.
tcp_probe() {
host="$1"; port="$2"
if command -v timeout >/dev/null 2>&1; then
timeout 2 bash -c ">/dev/tcp/${host}/${port}" 2>/dev/null
elif command -v gtimeout >/dev/null 2>&1; then
gtimeout 2 bash -c ">/dev/tcp/${host}/${port}" 2>/dev/null
else
bash -c ">/dev/tcp/${host}/${port}" 2>/dev/null &
probe_pid=$!
( sleep 2; kill "$probe_pid" 2>/dev/null ) >/dev/null 2>&1 &
killer_pid=$!
rc=0; wait "$probe_pid" 2>/dev/null || rc=$?
kill "$killer_pid" 2>/dev/null
return "$rc"
fi
}
line "WHO AND WHERE"
echo "hostname : $(hostname 2>/dev/null)"
echo "user : $(whoami 2>/dev/null) (root? $( [ "$(id -u 2>/dev/null)" = 0 ] && echo YES || echo no ))"
@@ -62,7 +82,7 @@ line "PRIVATE NETWORK REACH (the reason you self-host — and the reason it's da
PROBES=( "192.168.0.1:80" "192.168.1.1:80" "10.0.0.1:80" )
for hp in "${PROBES[@]}"; do
host="${hp%%:*}"; port="${hp##*:}"
if timeout 2 bash -c ">/dev/tcp/${host}/${port}" 2>/dev/null; then
if tcp_probe "$host" "$port"; then
echo " REACHABLE: ${host}:${port}"
fi
done