test(install): #74 wire matrix flags into go.sh + first-boot
Some checks failed
Check / eval (push) Has been cancelled

Generate unattended go.sh from NOMARCHY_TEST_SWAP_GB / NO_LUKS; skip
LUKS passphrase typing on first boot when cleartext.
This commit is contained in:
Bernardo Magri
2026-07-10 09:40:38 +01:00
parent 3760e39a54
commit a95cf49ddf

View File

@@ -75,21 +75,28 @@ nix build .#nixosConfigurations.nomarchy-live.config.system.build.isoImage
ISO=$(ls -1 result/iso/*.iso | head -n1)
echo "==> Preparing disks..."
echo " matrix: SWAP_GB=$TEST_SWAP_GB NO_LUKS=$TEST_NO_LUKS"
# Unattended config rides in on a tiny vfat disk: the installer test
# can't reliably TYPE a 200-char env line into the guest (keystrokes
# get dropped), but one short mount-and-run command works.
cat > "$VM_DIR/go.sh" <<'EOF'
#!/usr/bin/env bash
export NOMARCHY_UNATTENDED=1
export NOMARCHY_DISK=/dev/vda
export NOMARCHY_USERNAME=ada
export NOMARCHY_PASSWORD=nomarchy
export NOMARCHY_HOSTNAME=testbox
export NOMARCHY_LUKS_PASSPHRASE=testtest1
export NOMARCHY_SWAP_GB=2
export NOMARCHY_FINISH=poweroff
nomarchy-install 2>&1 | tee /tmp/install.log
EOF
{
echo '#!/usr/bin/env bash'
echo 'export NOMARCHY_UNATTENDED=1'
echo 'export NOMARCHY_DISK=/dev/vda'
echo 'export NOMARCHY_USERNAME=ada'
echo 'export NOMARCHY_PASSWORD=nomarchy'
echo 'export NOMARCHY_HOSTNAME=testbox'
echo "export NOMARCHY_SWAP_GB=$TEST_SWAP_GB"
echo 'export NOMARCHY_FINISH=poweroff'
if [[ "$TEST_NO_LUKS" == "1" ]]; then
echo 'export NOMARCHY_NO_LUKS=1'
echo 'unset NOMARCHY_LUKS_PASSPHRASE || true'
else
echo 'export NOMARCHY_LUKS_PASSPHRASE=testtest1'
fi
echo 'nomarchy-install 2>&1 | tee /tmp/install.log'
} > "$VM_DIR/go.sh"
chmod +x "$VM_DIR/go.sh"
rm -f "$VM_DIR/config.img"
truncate -s 8M "$VM_DIR/config.img"
mkfs.vfat "$VM_DIR/config.img" >/dev/null
@@ -150,16 +157,23 @@ trap 'kill $QPID 2>/dev/null || true' EXIT
until [ -S "$NOMARCHY_QMP_SOCK" ]; do sleep 2; done
sleep 40
python3 "$SHOT" "$VM_DIR/luks-prompt.png" 127.0.0.1 "59$VNC_DISPLAY"
python3 "$QMP" type 'testtest1'
python3 "$QMP" key ret
sleep 150
if [[ "$TEST_NO_LUKS" == "0" ]]; then
python3 "$SHOT" "$VM_DIR/luks-prompt.png" 127.0.0.1 "59$VNC_DISPLAY"
python3 "$QMP" type 'testtest1'
python3 "$QMP" key ret
sleep 150
else
# Cleartext disk — no LUKS prompt; give the session time to come up.
python3 "$SHOT" "$VM_DIR/boot-noluks.png" 127.0.0.1 "59$VNC_DISPLAY" || true
sleep 150
fi
python3 "$SHOT" "$VM_DIR/first-boot.png" 127.0.0.1 "59$VNC_DISPLAY"
python3 "$QMP" quit || true
trap - EXIT
echo
echo "PASS (machine-checkable part): install powered off, installed disk boots."
echo " matrix: SWAP_GB=$TEST_SWAP_GB NO_LUKS=$TEST_NO_LUKS"
echo "Now INSPECT $VM_DIR/first-boot.png:"
echo " expected: themed desktop (wallpaper + waybar), NO red banner, no login prompt"
echo " if it shows the Hyprland water-drop or an 'autogenerated config' banner,"