diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-28 21:45:59 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-28 21:45:59 +0200 |
| commit | bdb0899bdf996da826310ea3b4efa3ecad47b34b (patch) | |
| tree | 9a08d89675059bbbede4998b551f676e283a2205 /packages/buildvm/stop.sh | |
| parent | c141a204ed4a14759795804f87280ffef765f9c6 (diff) | |
Add OpenBSD build VM and dtail package infrastructure
Add a QEMU/KVM OpenBSD VM for native compilation of CGo packages
(e.g. dtail with DataDog/zstd). The VM is fully automated via expect
driving the serial console installer.
- packages/buildvm/: setup, provision, start, stop scripts and expect installer
- packages/scripts/pkg-dtail-openbsd.sh: multi-binary package with signify signing
- packages/Makefile: build VM management and dtail-openbsd target using git archive
- frontends/Rexfile: dtail_install task uses custom pkg repo, dtail task enabled
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'packages/buildvm/stop.sh')
| -rwxr-xr-x | packages/buildvm/stop.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/packages/buildvm/stop.sh b/packages/buildvm/stop.sh new file mode 100755 index 0000000..923ddaa --- /dev/null +++ b/packages/buildvm/stop.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Shut down the OpenBSD build VM gracefully. + +set -e + +VMDIR="$(cd "$(dirname "$0")" && pwd)" +PIDFILE="$VMDIR/qemu.pid" +SSH_PORT=2222 + +if [ ! -f "$PIDFILE" ] || ! kill -0 "$(cat "$PIDFILE")" 2>/dev/null; then + echo "Build VM is not running." + rm -f "$PIDFILE" + exit 0 +fi + +echo "Shutting down build VM..." +# Graceful shutdown via SSH, fall back to SIGTERM +ssh -q -o ConnectTimeout=5 -p "$SSH_PORT" pbuild@localhost "doas halt -p" 2>/dev/null || true + +# Wait for QEMU process to exit +PID=$(cat "$PIDFILE") +for i in $(seq 1 15); do + if ! kill -0 "$PID" 2>/dev/null; then + echo "VM stopped." + rm -f "$PIDFILE" + exit 0 + fi + sleep 1 +done + +# Force kill if still running +echo "Force-killing QEMU (PID $PID)..." +kill "$PID" 2>/dev/null || true +rm -f "$PIDFILE" |
