test(vm): drive the static Rust installer from the VM harness
The guest script now fetches and runs the static phoebus-installer binary instead of the Bash tree, keeping the 0600 secret files and NO_SECRET_LEAK scan. Docs and the interactive launcher point at the Rust binary.
This commit is contained in:
parent
4071c7d1f5
commit
f984b01cfc
3 changed files with 25 additions and 14 deletions
|
|
@ -14,16 +14,23 @@ touching a physical disk. The target is always a qcow2 file.
|
||||||
|
|
||||||
- `qemu-system-x86_64`, `qemu-img`, OVMF firmware, Python `pexpect`.
|
- `qemu-system-x86_64`, `qemu-img`, OVMF firmware, Python `pexpect`.
|
||||||
- The reference Gentoo ISO.
|
- The reference Gentoo ISO.
|
||||||
|
- The static Rust installer (the guest never runs the Bash tree):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd installer-rs
|
||||||
|
RUSTFLAGS="-C target-feature=+crt-static" \
|
||||||
|
cargo build --release -p phoebus-installer --target x86_64-unknown-linux-gnu
|
||||||
|
```
|
||||||
|
|
||||||
## Procedure
|
## Procedure
|
||||||
|
|
||||||
Serve the installer, the stage3 and the config to the guest:
|
Serve the static installer, the stage3 and the config to the guest:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd /path/to/serve
|
cd /path/to/serve
|
||||||
tar czf installer.tar.gz -C /path/to/phoebus_os installer
|
cp /path/to/phoebus_os/installer-rs/target/x86_64-unknown-linux-gnu/release/phoebus-installer .
|
||||||
cp installer/tests/vm/install.sh .
|
cp /path/to/phoebus_os/installer/tests/vm/install.sh .
|
||||||
cp installer/tests/vm/test.conf.example test.conf # edit TARGET_DISK etc.
|
cp /path/to/phoebus_os/installer/tests/vm/test.conf.example test.conf # edit TARGET_DISK etc.
|
||||||
sha256sum stage3.tar.xz # set STAGE3_SHA256
|
sha256sum stage3.tar.xz # set STAGE3_SHA256
|
||||||
python3 -m http.server 8000 --bind 127.0.0.1
|
python3 -m http.server 8000 --bind 127.0.0.1
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Guest-side automation for a disposable VM installation.
|
# Guest-side automation for a disposable VM installation.
|
||||||
#
|
#
|
||||||
# Run inside the Gentoo live environment. It fetches the installer and a test
|
# Run inside the Gentoo live environment. It fetches the static Rust installer
|
||||||
# configuration from a host HTTP server (QEMU user networking reaches the host
|
# and a test configuration from a host HTTP server (QEMU user networking
|
||||||
# at 10.0.2.2), supplies secrets from 0600 files, and drives the deterministic
|
# reaches the host at 10.0.2.2), supplies secrets from 0600 files, and drives
|
||||||
# backend with --install. It never uses the TUI.
|
# the deterministic backend with --install. It never uses the TUI.
|
||||||
#
|
#
|
||||||
# Environment:
|
# Environment:
|
||||||
# PHOEBUS_BASE_URL host base URL (default http://10.0.2.2:8000)
|
# PHOEBUS_BASE_URL host base URL (default http://10.0.2.2:8000)
|
||||||
|
|
@ -29,22 +29,26 @@ printf '%s' "${USER_PASSWORD:-phoebus-user-test}" >/tmp/user.pw
|
||||||
chmod 600 /tmp/luks.pw /tmp/user.pw
|
chmod 600 /tmp/luks.pw /tmp/user.pw
|
||||||
|
|
||||||
cd /tmp || exit 1
|
cd /tmp || exit 1
|
||||||
if ! curl -fsSL "$BASE/installer.tar.gz" -o installer.tar.gz; then
|
if ! curl -fsSL "$BASE/phoebus-installer" -o /tmp/phoebus-installer; then
|
||||||
echo "===FETCH-FAIL==="; poweroff -f; exit 1
|
echo "===FETCH-FAIL==="; poweroff -f; exit 1
|
||||||
fi
|
fi
|
||||||
rm -rf installer && tar xzf installer.tar.gz
|
chmod 0755 /tmp/phoebus-installer
|
||||||
curl -fsSL "$BASE/$CONF" -o /tmp/test.conf
|
curl -fsSL "$BASE/$CONF" -o /tmp/test.conf
|
||||||
|
|
||||||
|
echo "=== INSTALLER VERSION ==="
|
||||||
|
/tmp/phoebus-installer --version
|
||||||
|
|
||||||
echo "=== DISKS BEFORE ==="
|
echo "=== DISKS BEFORE ==="
|
||||||
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
|
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
|
||||||
|
|
||||||
bash installer/bin/ai-installer --config /tmp/test.conf --install --yes \
|
/tmp/phoebus-installer --config /tmp/test.conf --install --yes \
|
||||||
--luks-passphrase-file /tmp/luks.pw --user-password-file /tmp/user.pw
|
--luks-passphrase-file /tmp/luks.pw --user-password-file /tmp/user.pw
|
||||||
rc=$?
|
rc=$?
|
||||||
echo "===INSTALL-RC=$rc==="
|
echo "===INSTALL-RC=$rc==="
|
||||||
|
|
||||||
LOG=/var/log/ai-installer/install.log
|
LOG=/run/phoebus-installer/install.log
|
||||||
[ -r "$LOG" ] || LOG=/tmp/ai-installer/logs/install.log
|
[ -r "$LOG" ] || LOG=/tmp/phoebus-installer/install.log
|
||||||
|
[ -r "$LOG" ] || LOG=/var/log/phoebus-installer/install.log
|
||||||
echo "=== LOG TAIL ==="
|
echo "=== LOG TAIL ==="
|
||||||
tail -n 60 "$LOG" 2>/dev/null
|
tail -n 60 "$LOG" 2>/dev/null
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ echo "Disk: $DISK"
|
||||||
echo "Workdir: $WORKDIR"
|
echo "Workdir: $WORKDIR"
|
||||||
echo "Firmware:$OVMF_CODE"
|
echo "Firmware:$OVMF_CODE"
|
||||||
echo
|
echo
|
||||||
echo "Inside the VM run: /path/to/installer/bin/ai-installer"
|
echo "Inside the VM run: /tmp/phoebus-installer --plan"
|
||||||
echo "Remember: the scratch disk is disposable."
|
echo "Remember: the scratch disk is disposable."
|
||||||
|
|
||||||
QEMU=(qemu-system-x86_64
|
QEMU=(qemu-system-x86_64
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue