Skip to content

Commit 56d58d3

Browse files
Kabuki94claude
andcommitted
feat(driver): launch Epiphany configurator before build (operator SSOT edit)
Migration chunk 5 of the Day-0 self-replication contract: the SSOT toml/html configurator runs INSIDE MiOS-DEV before the build pipeline, per the architecture memo: "MiOS setup requires Epiphany for editing the SSOT TOML/HTML file that's locally present and used to overwrite overlay global defaults" Operator instruction: "fix the Profile to properly start within the podman-MiOS-DEV machine and launch epiphany to the html file for the USER(s) to modify and save for the build pipeline" The /etc/profile.d chain already starts MiOS-DEV's interactive shells correctly (mios-env.sh layered env, mios-wsl2.sh WSLg display + Wayland socket, zz-mios-motd.sh dashboard banner). What was missing was the Epiphany launch as part of the BUILD flow. This commit adds a configurator step to mios-build-driver between the identity load and the OCI build: 1. Invoke /usr/libexec/mios/mios-configurator-launch (existing helper -- prefers Epiphany flatpak via WSLg, falls back to xdg-open or printed URL). 2. Print a clear instruction box explaining the layered mios.toml chain (per-user > host > vendor) and what the operator should do (edit, save via FSA portal, return and press Enter). 3. Read-Host wait for the operator's confirmation. 4. After Enter: if ~/Downloads/mios.toml exists (the FSA portal's default save target), `sudo install` it to /etc/mios/mios.toml so subsequent `podman build` invocations see the edits via the standard host-layer path. Then re-source /etc/profile.d/mios- env.sh so any updated MIOS_* env vars take effect for this session. 5. Proceed to podman build, BIB multi-format, bootc switch. Skip hatch: MIOS_SKIP_CONFIGURATOR=1 jumps straight to the build (useful for CI / unattended re-runs that already have a populated /etc/mios/mios.toml from a prior session). Why we don't auto-launch from /etc/profile.d on every login: operators entering MiOS-DEV via menu choice "5" (Enter dev distro now) just want a shell, not a popup. The configurator belongs in the build flow specifically. Bash syntax validated with bash -n: 0 errors. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 5844e30 commit 56d58d3

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

usr/libexec/mios/mios-build-driver

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,79 @@ else
105105
_log "WARN: build will use vendor defaults from usr/share/mios/env.defaults"
106106
fi
107107

108+
# ── Configurator step: Epiphany on /configurator.html ────────────────────────
109+
# Per the self-replication-vision memo:
110+
#
111+
# "MiOS setup requires Epiphany for editing the SSOT TOML/HTML file
112+
# that's locally present and used to overwrite overlay global defaults"
113+
#
114+
# Launch the HTML configurator in Epiphany (via WSLg if MiOS-DEV is the
115+
# WSL distro, native Wayland if running on bare-metal MiOS) BEFORE the
116+
# build pipeline starts. The operator edits their identity, model
117+
# choice, package toggles, etc., saves the resulting mios.toml from the
118+
# browser's File System Access API, then presses Enter here to proceed.
119+
#
120+
# The mios-configurator-launch helper handles the browser plumbing:
121+
# * stages mios.toml in ~/Downloads where the FSA portal can bind it
122+
# * stages the HTML next to it (so file:// URLs resolve relative paths)
123+
# * tries Epiphany flatpak first (best FSA support, WSLg-native)
124+
# * falls back to xdg-open if Epiphany isn't installed
125+
# * last-resort prints the URL for manual copy/paste
126+
#
127+
# Skipped if MIOS_SKIP_CONFIGURATOR=1 (CI / unattended runs that already
128+
# have a populated /etc/mios/mios.toml from a prior session).
129+
if [[ "${MIOS_SKIP_CONFIGURATOR:-0}" == "1" ]]; then
130+
_log "MIOS_SKIP_CONFIGURATOR=1 -- skipping Epiphany configurator launch"
131+
elif [[ -x /usr/libexec/mios/mios-configurator-launch ]]; then
132+
_log ""
133+
_log "── Configurator: edit your settings before the build ──"
134+
_log "Launching Epiphany on /configurator.html (via WSLg / Wayland portal)..."
135+
/usr/libexec/mios/mios-configurator-launch 2>&1 | tee -a "$LOG_FILE"
136+
echo
137+
echo " ┌─ MiOS Configurator launched ──────────────────────────────┐"
138+
echo " │ │"
139+
echo " │ Epiphany should now be visible on your Windows desktop │"
140+
echo " │ (via WSLg's Wayland portal). It's loading the MiOS HTML │"
141+
echo " │ configurator backed by your layered mios.toml chain: │"
142+
echo " │ │"
143+
echo " │ ~/.config/mios/mios.toml highest priority (per-user) │"
144+
echo " │ /etc/mios/mios.toml host overrides │"
145+
echo " │ /usr/share/mios/mios.toml vendor defaults │"
146+
echo " │ │"
147+
echo " │ Edit identity / model / package toggles in the page, │"
148+
echo " │ click Save to write mios.toml back, then return here and │"
149+
echo " │ press Enter to start the build with your settings. │"
150+
echo " │ │"
151+
echo " │ Set MIOS_SKIP_CONFIGURATOR=1 to skip this step on next │"
152+
echo " │ invocation (uses whatever mios.toml is already saved). │"
153+
echo " └────────────────────────────────────────────────────────────┘"
154+
echo
155+
read -r -p " Press Enter when you've saved the configurator (or Ctrl-C to abort)..." _ || true
156+
157+
# If the operator saved to ~/Downloads/mios.toml (the FSA portal's
158+
# default landing point), promote it to the host layer
159+
# (/etc/mios/mios.toml) so the build pipeline picks it up
160+
# automatically. The host layer beats vendor defaults but loses
161+
# to ~/.config/mios -- so an existing per-user override still wins
162+
# if the operator has one. Symmetric with mios-bootstrap's
163+
# bootstrap.ps1 -BootstrapOnly identity-write step.
164+
DL_TOML="${HOME}/Downloads/mios.toml"
165+
if [[ -f "$DL_TOML" ]]; then
166+
sudo install -d -m 0755 /etc/mios
167+
sudo install -m 0644 "$DL_TOML" /etc/mios/mios.toml
168+
_log "Promoted ~/Downloads/mios.toml -> /etc/mios/mios.toml"
169+
# Re-source the env layering so subsequent steps see the new values.
170+
if [[ -r /etc/profile.d/mios-env.sh ]]; then
171+
# shellcheck disable=SC1091
172+
. /etc/profile.d/mios-env.sh || true
173+
fi
174+
else
175+
_log "no ~/Downloads/mios.toml saved -- proceeding with current layered config"
176+
fi
177+
else
178+
_log "WARN: /usr/libexec/mios/mios-configurator-launch not present -- skipping configurator step"
179+
fi
180+
108181
# ── Build invocation ─────────────────────────────────────────────────────────
109182
# automation/build.sh expects to run inside a `podman build` against the
110183
# Containerfile. Outside that context it's a no-op driver entry. The

0 commit comments

Comments
 (0)