#!/usr/bin/env bash
# Real demos for P117 "Linux Makefiles Will Finally Make Sense After This". Runs on Docker (the Mac's or render01's).
# One stock Ubuntu 24.04 container stands in for the Linux box at a ferry ticket office (lab/Dockerfile). Ana types
# into one real interactive bash in a pty (demo_driver.py); the files she edits are copied into her home folder off
# camera from /srv/src and /srv/mk, one file at a time, like a file saved from an editor (so each gets a new time).
set -euo pipefail
cd "$(dirname "$0")"
P=ce-p117
cleanup() { docker rm -f $P-box >/dev/null 2>&1 || true; }
cleanup
[ -n "${KEEP:-}" ] || trap cleanup EXIT
docker build -q -t $P-box lab >/dev/null
docker run -d --name $P-box --hostname office --network none $P-box >/dev/null
sleep 1
python3 - "$P" < demo_driver.py
