Initial public import of the proven Bash installer (installer/) and the production Rust workspace (installer-rs/). The reference ISO, build output and local agent transcripts are gitignored. Verified: installer/tests/run_tests.sh and cargo test --workspace both pass.
60 lines
2 KiB
Bash
Executable file
60 lines
2 KiB
Bash
Executable file
#!/bin/bash
|
|
# Guest-side automation for a disposable VM installation.
|
|
#
|
|
# Run inside the Gentoo live environment. It fetches the 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/installer.tar.gz" -o installer.tar.gz; then
|
|
echo "===FETCH-FAIL==="; poweroff -f; exit 1
|
|
fi
|
|
rm -rf installer && tar xzf installer.tar.gz
|
|
curl -fsSL "$BASE/$CONF" -o /tmp/test.conf
|
|
|
|
echo "=== DISKS BEFORE ==="
|
|
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
|
|
|
|
bash installer/bin/ai-installer --config /tmp/test.conf --install --yes \
|
|
--luks-passphrase-file /tmp/luks.pw --user-password-file /tmp/user.pw
|
|
rc=$?
|
|
echo "===INSTALL-RC=$rc==="
|
|
|
|
LOG=/var/log/ai-installer/install.log
|
|
[ -r "$LOG" ] || LOG=/tmp/ai-installer/logs/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
|