#!/usr/bin/env bash
# Real demos for P102 "Linux Bash Scripting: Full Tutorial for Beginners". Runs on render01's Docker. One stock
# Ubuntu 24.04 container stands in for the weather station's small Linux box (lab/Dockerfile). Ana types into one real
# interactive bash in a pty (demo_driver.py); the scripts she writes are copied into her home folder off camera from
# lab/s1..s10, one step at a time, and shown with cat. The report page her last script writes is copied out to
# lab_out/ so a real browser can load it (lab/capture.py, on the Mac).
set -euo pipefail
cd "$(dirname "$0")"
P=ce-p102
cleanup() { docker rm -f $P-station >/dev/null 2>&1 || true; }
cleanup
[ -n "${KEEP:-}" ] || trap cleanup EXIT
docker build -q -t $P-station lab >/dev/null
docker run -d --name $P-station --hostname station --network none $P-station >/dev/null
sleep 1
python3 - "$P" < demo_driver.py
