Skip to content

Commit 71c717d

Browse files
mios-devclaude
andcommitted
PHASE: align global phase numbering; relocate user-space content to mios-bootstrap
Document the global Phase-0..4 numbering (CLAUDE.md, INDEX.md, ENGINEERING.md): the numbered automation/[0-9][0-9]-*.sh scripts are sub-phases of Phase-2 (build), not top-level phases. Relocate to mios-bootstrap.git (per system-prompt §3 — /etc/mios/, /home/, /agents/ are bootstrap territory): - etc/mios/ai/mi-os.yaml — moved to mios-bootstrap/etc/mios/ai/ - agents/research/ — knowledge graphs / RAG manifests live in bootstrap - home/.keep — bootstrap stages user homes via profile/ - srv/.keep, srv/ai/.keep — directory structure declared by usr/lib/tmpfiles.d/mios.conf at runtime; placeholders unnecessary .gitignore: drop the matching whitelist negations for /etc/mios/, /home/, /srv/, /agents/. mios.git now only whitelists genuinely system-layer paths. install.sh: re-cast as the Phase-3 system-init half (sysusers, tmpfiles, daemon-reload, service enable). Header documents that bootstrap install.sh invokes this after Phase-1 overlay and Phase-2 package install have completed. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 608bfd9 commit 71c717d

11 files changed

Lines changed: 78 additions & 56 deletions

File tree

.gitignore

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@
5858
!/tools/**
5959
!/config/
6060
!/config/**
61-
!/agents/
62-
!/agents/**
6361

6462
# ─────────────────────────────────────────────────────────────────────────────
6563
# 4. /v1 — MiOS AI API surface
@@ -81,27 +79,15 @@ etc/containers/systemd/*
8179
!/etc/fapolicyd/
8280
etc/fapolicyd/*
8381
!/etc/fapolicyd/fapolicyd.rules
84-
!/etc/mios/
85-
!/etc/mios/**
8682

87-
# ─────────────────────────────────────────────────────────────────────────────
88-
# 6. /home — placeholder only (no user data tracked)
89-
# ─────────────────────────────────────────────────────────────────────────────
90-
!/home/
91-
home/*
92-
!/home/.keep
93-
94-
# ─────────────────────────────────────────────────────────────────────────────
95-
# 7. /srv — MiOS service data
96-
# ─────────────────────────────────────────────────────────────────────────────
97-
!/srv/
98-
srv/*
99-
!/srv/.keep
100-
!/srv/ai/
101-
!/srv/ai/**
83+
# /etc/mios/ is BOOTSTRAP territory (mios-bootstrap.git). Not tracked here.
84+
# /home/ is BOOTSTRAP territory. Per-user templates and skel live in mios-bootstrap.
85+
# /srv/ structure is created at runtime by usr/lib/tmpfiles.d/mios.conf — no
86+
# placeholder files tracked here.
87+
# /agents/ is BOOTSTRAP territory (knowledge graphs / RAG manifests).
10288

10389
# ─────────────────────────────────────────────────────────────────────────────
104-
# 8. /root — MiOS shell skeleton for root user
90+
# 6. /root — MiOS shell skeleton for root user (system layer)
10591
# ─────────────────────────────────────────────────────────────────────────────
10692
!/root/
10793
root/*

CLAUDE.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,31 @@ Day-2 (deployed host): `sudo bootc upgrade && sudo systemctl reboot`,
6262

6363
## Architecture (the parts that span multiple files)
6464

65-
### The build pipeline
65+
### Global pipeline phases
66+
67+
The full bootstrap → install pipeline is partitioned into five global phases.
68+
Every doc, log line, and orchestrator script in either repo refers to these
69+
by number:
70+
71+
| Phase | Owner | Purpose |
72+
|---|---|---|
73+
| **Phase-0** | `mios-bootstrap.git/install.sh` | Preflight, profile load, host-kind detection, interactive identity capture. |
74+
| **Phase-1** | `mios-bootstrap.git/install.sh` (`trigger_mios_install`) | Total Root Merge — clone `mios.git` into `/`, copy bootstrap overlays (etc/, usr/, var/, profile/) on top. |
75+
| **Phase-2** | `Containerfile` + `automation/build.sh` (or FHS package install) | Build the running system. The numbered `automation/[0-9][0-9]-*.sh` scripts are *sub-phases* of Phase-2. |
76+
| **Phase-3** | `mios.git/install.sh` + `mios-bootstrap.git/install.sh` (`apply_user_profile`, `deploy_system_prompt`, `stage_user_profile_artifacts`) | systemd-sysusers, systemd-tmpfiles, daemon-reload, services; create the Linux user; stage `~/.config/mios/{profile.toml,system-prompt.md}` and host `/etc/mios/ai/system-prompt.md`. |
77+
| **Phase-4** | `mios-bootstrap.git/install.sh` (`reboot_prompt`) | Interactive `systemctl reboot`. |
78+
79+
### The build pipeline (Phase-2 sub-phases)
6680

6781
`Containerfile` is small. Its single big `RUN` calls
6882
`automation/08-system-files-overlay.sh` (overlay apply) then
6983
`automation/build.sh` — the master orchestrator that iterates every
70-
`automation/[0-9][0-9]-*.sh` in numeric order. Phase numbering is meaningful
71-
(repos → kernel → overlay → stack install → service config → user/GPU
72-
AI/SELinux/polish → supply chain → finalize → from-source kmods → validate);
73-
do not renumber without understanding the dependency it encodes. Skipped
74-
under build: `08-system-files-overlay.sh` (runs pre-pipeline from
75-
Containerfile), `37-ollama-prep.sh` (CI-skipped).
84+
`automation/[0-9][0-9]-*.sh` in numeric order. The numbering is internal to
85+
Phase-2 and encodes dependencies (repos → kernel → overlay → stack install →
86+
service config → user/GPU → AI/SELinux/polish → supply chain → finalize →
87+
from-source kmods → validate). Do not renumber without understanding the
88+
dependency. Skipped under build: `08-system-files-overlay.sh` (runs
89+
pre-pipeline from Containerfile), `37-ollama-prep.sh` (CI-skipped).
7690

7791
Every script sources `automation/lib/{common,packages,masking}.sh`. The
7892
masking library filters secrets out of build logs; output is teed through

ENGINEERING.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
# MiOS Engineering Standards
22

3-
## Build pipeline
3+
## Global pipeline phases
4+
5+
The end-to-end pipeline (bootstrap → install) is partitioned into five
6+
phases. The numbered `automation/[0-9][0-9]-*.sh` scripts are *sub-phases*
7+
of Phase-2 (build).
8+
9+
| Phase | Owner | Description |
10+
|---|---|---|
11+
| Phase-0 | `mios-bootstrap.git/install.sh` | Preflight + profile load + identity capture |
12+
| Phase-1 | `mios-bootstrap.git/install.sh` | Total Root Merge of `mios.git` and `mios-bootstrap.git` to `/` |
13+
| Phase-2 | `Containerfile`/`automation/build.sh` | Build the running system (this section's subject) |
14+
| Phase-3 | `mios.git/install.sh` + bootstrap profile staging | systemd-sysusers/tmpfiles/daemon-reload + user create + per-user `~/.config/mios/{profile.toml,system-prompt.md}` |
15+
| Phase-4 | `mios-bootstrap.git/install.sh` | Reboot prompt |
16+
17+
## Phase-2: build pipeline (sub-phases)
418

519
`Containerfile` triggers `automation/build.sh`, which iterates every
620
`automation/[0-9][0-9]-*.sh` in numeric order. Skipped under build:
721
`08-system-files-overlay.sh` (runs pre-pipeline from `Containerfile`),
8-
`37-ollama-prep.sh` (CI-skipped). Phase numbering encodes dependency order
9-
and must be preserved when adding new scripts. See `CLAUDE.md` for the
10-
phase ranges.
22+
`37-ollama-prep.sh` (CI-skipped). Sub-phase numbering encodes dependency
23+
order and must be preserved when adding new scripts. See `CLAUDE.md` for
24+
the sub-phase ranges.
1125

1226
Per-phase error handling: `automation/build.sh:234-237` toggles `set +e`
1327
around each script invocation so individual failures are captured in

INDEX.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,24 @@ Spec: <https://platform.openai.com/docs/api-reference>.
4646
| `MIOS_USER` / `MIOS_HOSTNAME` | build | Default account/hostname baked into the image (`Containerfile:26-27`). |
4747
| `MIOS_FLATPAKS` | build | Comma-separated Flatpak refs (`Containerfile:28`). |
4848

49-
## 5. Cross-references
49+
## 5. Global pipeline phases
50+
51+
The end-to-end bootstrap → install pipeline is partitioned into five phases
52+
shared across both repos:
53+
54+
| Phase | Owner repo | Purpose |
55+
|---|---|---|
56+
| Phase-0 | `mios-bootstrap` | Preflight, profile load, identity capture |
57+
| Phase-1 | `mios-bootstrap` | Total Root Merge (clone `mios.git` into `/`, overlay bootstrap) |
58+
| Phase-2 | `mios` | Build (Containerfile + `automation/[0-9][0-9]-*.sh` sub-phases, OR dnf install on FHS) |
59+
| Phase-3 | both | sysusers/tmpfiles/services + user create + per-user `~/.config/mios/{profile.toml,system-prompt.md}` staging |
60+
| Phase-4 | `mios-bootstrap` | Reboot |
61+
62+
The user profile card at `etc/mios/profile.toml` (host) and
63+
`~/.config/mios/profile.toml` (per-user) is read in Phase-0 to seed defaults
64+
and re-written/staged in Phase-3.
65+
66+
## 6. Cross-references
5067

5168
- Build pipeline architecture: `CLAUDE.md`, `automation/build.sh`.
5269
- Filesystem and hardware layout: `ARCHITECTURE.md`.

agents/research/.keep

Whitespace-only changes.

agents/research/manifest.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

etc/mios/ai/mi-os.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

home/.keep

Whitespace-only changes.

install.sh

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
#!/usr/bin/env bash
2-
# MiOS system-side installer (FHS overlay path).
2+
# MiOS system-side installer — runs as the system-init half of Phase-3
3+
# (Apply). Invoked by mios-bootstrap.git/install.sh after Phase-1 (overlay)
4+
# and Phase-2 (package install) have already completed.
35
#
4-
# This script is invoked by the bootstrap installer on non-bootc Fedora hosts.
5-
# On bootc-managed hosts, do NOT run this -- use `bootc switch` instead.
6+
# Refuses to run on bootc-managed hosts (their /usr is read-only composefs);
7+
# on bootc, Phase-2/3 are handled by `bootc switch`.
68
#
7-
# What it does:
8-
# 1. Refuses to run on bootc-managed hosts (their /usr is read-only composefs).
9-
# 2. Lays down the FHS overlay from this repository's working tree to /.
10-
# 3. Runs systemd-sysusers, systemd-tmpfiles, and reloads systemd units.
11-
# 4. Enables MiOS services.
9+
# What this script does (Phase-3 system-init responsibilities):
10+
# 1. Lay down any remaining FHS overlay rsyncs from this repository's
11+
# working tree to / (idempotent if bootstrap already merged via git).
12+
# 2. systemd-sysusers (creates mios + sidecar service accounts).
13+
# 3. systemd-tmpfiles --create (declares /var/, /run/, /etc/cdi paths).
14+
# 4. systemctl daemon-reload + enable MiOS services.
1215

1316
set -euo pipefail
1417

@@ -25,7 +28,7 @@ if [[ $EUID -ne 0 ]]; then
2528
fi
2629

2730
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
28-
echo "[INFO] MiOS system installer running from ${REPO_ROOT}"
31+
echo "[INFO] Phase-3 — MiOS system installer running from ${REPO_ROOT}"
2932

3033
if [[ "${REPO_ROOT}" != "/" ]]; then
3134
# Apply FHS overlay. We rsync each top-level overlay dir if it exists.
@@ -59,5 +62,6 @@ if [[ -f /etc/containers/systemd/mios-ai.container ]]; then
5962
systemctl enable --now mios-ai.service || echo "[WARN] mios-ai.service not yet active; will retry on boot"
6063
fi
6164

62-
echo "[ OK ] MiOS system installer complete."
63-
echo " Log out and back in (or reboot) to pick up profile changes."
65+
echo "[ OK ] Phase-3 — MiOS system installer complete."
66+
echo " Control returns to mios-bootstrap install.sh for Phase-3 user"
67+
echo " staging and Phase-4 reboot prompt."

srv/.keep

Whitespace-only changes.

0 commit comments

Comments
 (0)