#!/bin/bash # Guest-side VM verification for the AI-first installation workflow. # # Boots the reference Gentoo LiveGUI ISO and exercises `sys install` through # the deterministic CLI and the read-only investigation surface. The live medium # ships no Portage tree (it syncs during install), so the explicit install step # runs only when a tree is already present; otherwise it is skipped and the # read-only workflow checks are the evidence. A real install journey runs on an # *installed* target (see docs/HANDOFF.md). set -u export PATH=/usr/sbin:/usr/bin:/sbin:/bin BASE="${PHOEBUS_BASE_URL:-http://10.0.2.2:8000}" PKG="${SYS_CHECK_PACKAGE:-app-misc/hello}" echo "===LIVE-SYS-START===" cd /tmp || exit 1 if ! curl -fsSL "$BASE/sys" -o /tmp/sys; then echo "===SYS-FETCH-FAIL==="; poweroff -f; exit 1 fi chmod 0755 /tmp/sys echo "--- version ---" /tmp/sys --version echo "--- sync the Portage tree (the live medium ships none) ---" if timeout 1500 emerge --sync --quiet >/tmp/sync.log 2>&1; then echo "sync-ok" else echo "sync-failed rc=$?; tail:"; tail -5 /tmp/sync.log fi echo "--- conflicting flags must be rejected ---" /tmp/sys install firefox --flatpak --nix echo "conflict-rc=$?" echo "--- unqualified install with no model must not install ---" PHOEBUS_AI_PROVIDER= PHOEBUS_AI_BACKEND=direct /tmp/sys install "$PKG" echo "no-model-rc=$?" echo "--- check_backend ---" /tmp/sys --action '{"action":"check_backend","backend":"portage-source"}' echo "--- discover_candidates ---" /tmp/sys --action "{\"action\":\"discover_candidates\",\"query\":\"$PKG\"}" echo "--- explicit Portage install (deterministic, no model) ---" if [ -d /var/db/repos/gentoo/profiles ]; then /tmp/sys -y install "$PKG" --portage echo "portage-install-rc=$?" echo "--- verify in the package database ---" ls -d /var/db/pkg/app-misc/hello-* 2>&1 else echo "skip: the live medium ships no Portage tree (sync took too long)" echo "portage-install-rc=skipped" fi echo "--- history ---" /tmp/sys history if [ -d /var/db/pkg/app-misc ]; then echo "--- remove to leave the live medium clean ---" /tmp/sys -y remove "$PKG" echo "remove-rc=$?" fi echo "===LIVE-SYS-DONE===" sync echo "===INSTALL-RC=0===" poweroff -f echo "===POWEROFF==="