Offer OEM mode only when the bundled runtime supports it
The configurator now peeks into the offline mirror's runtime package for omarchy-oem-setup before offering the OEM install mode, so an ISO built against a pre-OEM runtime can't start an install doomed to fail at the staging phase (which still hard-checks as the backstop). Blank disks with no OEM choice to offer skip the mode picker entirely, like the pre-OEM flow. Also keep the test harness QMP socket in /tmp — unix socket paths cap at ~108 bytes, which nested test-run directories can exceed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
679edce2e3
commit
b5f7e96c70
2 files changed
+37
-3
No files matched your search
@@ -101,7 +101,9 @@ HTTP_PID=""
|
||||
|
||||
mkdir -p "$BASE_DIR" "$RUN_DIR"
|
||||
|
||||
QMP_SOCK="$RUN_DIR/qmp.sock"
|
||||
# Unix socket paths are capped at ~108 bytes, which a run directory nested in
|
||||
# test-runs/<iso-name>/runs/<timestamp> can exceed. Keep the socket in /tmp.
|
||||
QMP_SOCK=$(mktemp -u "${TMPDIR:-/tmp}/omarchy-iso-test-qmp.XXXXXX.sock")
|
||||
PIDFILE="$RUN_DIR/qemu.pid"
|
||||
|
||||
log() {
|
||||
|
||||
@@ -781,6 +781,24 @@ open_partition_tool() {
|
||||
sleep 1
|
||||
}
|
||||
|
||||
# OEM mode needs the bundled runtime package to ship the first-boot setup
|
||||
# (omarchy-oem-setup); an ISO built against an older runtime must not offer a
|
||||
# mode whose install would fail at the staging phase. Peek into the offline
|
||||
# mirror's runtime package once; outside the ISO (dry runs) offer the mode.
|
||||
oem_supported() {
|
||||
if [[ -z ${OEM_SUPPORTED:-} ]]; then
|
||||
local mirror=/var/cache/omarchy/mirror/offline pkg
|
||||
OEM_SUPPORTED=true
|
||||
if [[ -d $mirror ]]; then
|
||||
pkg=$(ls "$mirror/$OMARCHY_RUNTIME_PACKAGE"-[0-9]*.pkg.tar.zst 2>/dev/null | head -1)
|
||||
if [[ -z $pkg ]] || ! tar -tf "$pkg" usr/bin/omarchy-oem-setup &>/dev/null; then
|
||||
OEM_SUPPORTED=false
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
[[ $OEM_SUPPORTED == true ]]
|
||||
}
|
||||
|
||||
# If the disk has no partition table or no unallocated free space, the only
|
||||
# viable paths write the whole disk, so the free-space mode is not offered.
|
||||
requires_full_disk_install() {
|
||||
@@ -814,7 +832,9 @@ install_mode_form() {
|
||||
fi
|
||||
# OEM: install the whole system now, defer user setup to the machine's
|
||||
# first boot — for machines built to be sold or handed on.
|
||||
choices+=("OEM install (new owner creates their user on first boot)")
|
||||
if oem_supported; then
|
||||
choices+=("OEM install (new owner creates their user on first boot)")
|
||||
fi
|
||||
choices+=("Choose a different disk")
|
||||
|
||||
step "Let's select how to install Omarchy..."
|
||||
@@ -871,7 +891,14 @@ select_installation() {
|
||||
else
|
||||
full_disk_only=false
|
||||
fi
|
||||
install_mode_form
|
||||
|
||||
# A blank disk with no OEM choice to offer has exactly one viable mode;
|
||||
# skip the picker like the pre-OEM flow did.
|
||||
if $full_disk_only && ! oem_supported; then
|
||||
install_mode="Full disk install"
|
||||
else
|
||||
install_mode_form
|
||||
fi
|
||||
|
||||
case "$install_mode" in
|
||||
"Full disk install")
|
||||
@@ -880,6 +907,11 @@ select_installation() {
|
||||
install_target="full_disk"
|
||||
return 0
|
||||
fi
|
||||
# When the picker was skipped there is no menu to fall back to;
|
||||
# declining the overwrite means picking another disk, as before.
|
||||
if $full_disk_only && ! oem_supported; then
|
||||
disk_form
|
||||
fi
|
||||
;;
|
||||
"OEM install"*)
|
||||
oem_install=true
|
||||
|
||||
Reference in new issue
Block a user