phoebus_os/installer/tests/vm/install.sh
Phoebus 4934b4c221 test(vm): run the deterministic install with the --no-ai break-glass
The install harness drives the deterministic backend, which must pass the
documented --no-ai break-glass to satisfy the mandatory-AI install gate. The
previous invocation omitted it and the installer correctly refused.
2026-09-23 20:31:07 -07:00

70 lines
2.4 KiB
Bash
Executable file

#!/bin/bash
# Guest-side automation for a disposable VM installation.
#
# Run inside the Gentoo live environment. It fetches the static Rust installer
# and a test configuration from a host HTTP server (QEMU user networking
# reaches the host at 10.0.2.2), supplies secrets from 0600 files, and drives
# the deterministic backend with --install. It never uses the TUI.
#
# Environment:
# PHOEBUS_BASE_URL host base URL (default http://10.0.2.2:8000)
# PHOEBUS_CONFIG config file name on the server (default test.conf)
# LUKS_PASSPHRASE LUKS passphrase (kept in a 0600 temp file, never logged)
# USER_PASSWORD user password
#
# The test configuration pins STAGE3_URL to the same HTTP server so the
# stage3 checksum is verified without re-downloading from the internet.
set -u
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
export PHOEBUS_LOG_ECHO=yes
BASE="${PHOEBUS_BASE_URL:-http://10.0.2.2:8000}"
CONF="${PHOEBUS_CONFIG:-test.conf}"
echo "===PHOEBUS-DRIVER-START==="
umask 077
printf '%s' "${LUKS_PASSPHRASE:-phoebus-luks-test}" >/tmp/luks.pw
printf '%s' "${USER_PASSWORD:-phoebus-user-test}" >/tmp/user.pw
chmod 600 /tmp/luks.pw /tmp/user.pw
cd /tmp || exit 1
if ! curl -fsSL "$BASE/phoebus-installer" -o /tmp/phoebus-installer; then
echo "===FETCH-FAIL==="; poweroff -f; exit 1
fi
chmod 0755 /tmp/phoebus-installer
# The deterministic `sys` CLI is a hard requirement of the installed system, so
# the installer locates it beside itself and installs it into the target.
if ! curl -fsSL "$BASE/sys" -o /tmp/sys; then
echo "===SYS-FETCH-FAIL==="; poweroff -f; exit 1
fi
chmod 0755 /tmp/sys
curl -fsSL "$BASE/$CONF" -o /tmp/test.conf
echo "=== INSTALLER VERSION ==="
/tmp/phoebus-installer --version
echo "=== DISKS BEFORE ==="
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
/tmp/phoebus-installer --config /tmp/test.conf --install --yes --no-ai \
--luks-passphrase-file /tmp/luks.pw --user-password-file /tmp/user.pw
rc=$?
echo "===INSTALL-RC=$rc==="
LOG=/run/phoebus-installer/install.log
[ -r "$LOG" ] || LOG=/tmp/phoebus-installer/install.log
[ -r "$LOG" ] || LOG=/var/log/phoebus-installer/install.log
echo "=== LOG TAIL ==="
tail -n 60 "$LOG" 2>/dev/null
echo "===SECRET-SCAN==="
if grep -a -e "${LUKS_PASSPHRASE:-phoebus-luks-test}" \
-e "${USER_PASSWORD:-phoebus-user-test}" "$LOG" 2>/dev/null; then
echo "SECRET_LEAK_FOUND"
else
echo "NO_SECRET_LEAK"
fi
sync
echo "===POWEROFF==="
poweroff -f