Split into qemu and proxmox platforms over a shared content tree

platforms/qemu and platforms/proxmox each have their own lab.sh and
lab.conf; content/ holds everything shared (roles, seed, site, helpers).
The dispatcher, preflight and command implementations are common and take
platform differences from the backend.

Proxmox backend: qm create with q35/SATA/e1000, ISOs and seed ISOs in an
ISO storage, provisioning over qm guest exec (no Python packages needed on
the host), template + clone for reset, and peers/ to emit WireGuard configs.
The role scripts now ride on the seed ISO, so provisioning transfers nothing.

build-bundle.sh produces a self-contained tarball per platform, for hosts
that cannot reach the git server.

Both configs are generic: no absolute path from this machine remains.
This commit is contained in:
2026-10-22 19:23:16 -04:00
parent 538fb9a117
commit 890dd58700
349 changed files with 1142 additions and 2236 deletions
+67
View File
@@ -0,0 +1,67 @@
#!/usr/bin/env bash
# build-bundle.sh — produce a self-contained tarball for one platform.
#
# ./build-bundle.sh both platforms
# ./build-bundle.sh proxmox only the Proxmox bundle
# ./build-bundle.sh qemu /tmp/out custom output directory
#
# The bundle carries the shared content, the platform entrypoint, the docs and
# the answer key, so it can be copied to a host that cannot reach the git
# server: scp norbourg-proxmox.tar.gz root@pve:/root/ && tar xzf ...
set -euo pipefail
ROOT=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
TARGET=${1:-all}
OUT=${2:-$ROOT/dist}
info() { printf '[*] %s\n' "$*"; }
ok() { printf '[ok] %s\n' "$*"; }
build() {
local platform=$1
local stage="$OUT/norbourg-$platform"
local archive="$OUT/norbourg-$platform.tar.gz"
[[ -d $ROOT/platforms/$platform ]] || { echo "no such platform: $platform" >&2; return 1; }
rm -rf "$stage"
mkdir -p "$stage"
# Shared content + one platform + docs + answers. Generated and transient
# paths are excluded: they are rebuilt by the host's own commands.
tar -C "$ROOT" -cf - \
--exclude='.git' \
--exclude='__pycache__' \
--exclude='*.pyc' \
--exclude='content/web/site' \
--exclude='content/seed/out' \
--exclude='dist' \
content "platforms/$platform" docs answers README.md \
| tar -C "$stage" -xf -
# Trim the platform directories we did not ask for.
find "$stage/platforms" -mindepth 1 -maxdepth 1 -type d ! -name "$platform" -exec rm -rf {} +
tar -C "$OUT" -czf "$archive" "norbourg-$platform"
ok "$archive ($(du -h "$archive" | cut -f1))"
}
mkdir -p "$OUT"
case $TARGET in
all)
build qemu
build proxmox
;;
qemu|proxmox)
build "$TARGET"
;;
*)
echo "usage: $0 [qemu|proxmox|all] [output-dir]" >&2
exit 2
;;
esac
printf '\n'
info "copy to the target host, then:"
info " tar xzf norbourg-<platform>.tar.gz && cd norbourg-<platform>"
info " ./platforms/<platform>/lab.sh check"