Compare commits
24 commits
9573f2e37a
...
bdec0bdfe8
| Author | SHA1 | Date | |
|---|---|---|---|
| bdec0bdfe8 | |||
| c806c98267 | |||
| 7124c8ed5c | |||
| 2261c5483c | |||
| bea96f543d | |||
| 497cba6b81 | |||
| 78d5680a79 | |||
| 2b8559f113 | |||
| de2d7918c3 | |||
| add7dfc873 | |||
| 24b11ebb98 | |||
| 0dc6663c34 | |||
| 233a3e2f7f | |||
| 8a0dfdf965 | |||
| 0036529f51 | |||
| f480c9c3b7 | |||
| 3abdc872e2 | |||
| 6972511315 | |||
| ff104ddc49 | |||
| 5ea4bb1885 | |||
| bf72ca8de9 | |||
| 0aa31a36a0 | |||
| aecfd3262e | |||
| 406f9b4b33 |
10 changed files with 512 additions and 61 deletions
|
|
@ -5,6 +5,17 @@ this file is the curated, human-readable summary.
|
|||
|
||||
## Unreleased — Fast defaults with user-controlled source builds
|
||||
|
||||
- **Headless dual-target stabilization & detached boot proven (Run 13).**
|
||||
Completed full 12-stage non-interactive headless installation on an 80 GiB
|
||||
disposable VM (`phoebus-headless-80g.qcow2`) without touching host disks.
|
||||
All 347 desktop packages emerged in ~2.8 h, 588 compile times recorded, and
|
||||
initial known-good Btrfs snapshots created (`@-20260928T060439-initial-known-good`
|
||||
and `@var`). Detached boot from disk alone verified: LUKS2 auto-unlock,
|
||||
systemd PID 1 with 0 failed units, `seatd.service` active and running
|
||||
(`/run/seatd.sock` mode 0660 root:seat), `sys-acceptance.sh` suite passing
|
||||
40/40, fast-defaults verified in Gentoo VDB (`firefox-bin`, `libreoffice-bin`,
|
||||
`thunderbird-bin`, `brave-browser`), and Flatpaks verified in `/var/lib/flatpak`
|
||||
(`calibre`, `gimp`, `flatseal`).
|
||||
- **Fast default installation.** The Mango profile now installs
|
||||
`www-client/firefox-bin` and `app-office/libreoffice-bin` (maintained
|
||||
stable Gentoo binary redistributions, signature verification preserved).
|
||||
|
|
|
|||
|
|
@ -3,6 +3,51 @@
|
|||
Rolling note between work sessions. **Update this file before you finish**, then
|
||||
commit it. It should be short and current; use `git log` for detail.
|
||||
|
||||
- **Headless stabilization run (SELF-HEALING LOOP ACTIVE, run 10 IN FLIGHT):**
|
||||
Failures so far, each fixed + committed + verified green (761 tests) + rerun:
|
||||
1. Brave overlay pin missing → recorded reviewed pin `d3a97f22…` (`0aa31a3`).
|
||||
2. `/bin/zsh` missing at `users_configure` (Zsh lane only in desktop, which
|
||||
runs later) → shell lane moved to `base_packages` (`5ea4bb1`).
|
||||
3. `zsh-autosuggestions` masked `~amd64` → `accept_keywords_shell()` wired
|
||||
into the GURU block (`ff104dd`).
|
||||
4. GURU `zsh-autosuggestions` needs `>=zsh-5.9.1`, stable is `5.9-r7` →
|
||||
keyworded `app-shells/zsh` itself (`6972511`).
|
||||
5. `swayimg` REQUIRED_USE `exactly-one-of lua_single_target_*` (profile
|
||||
enables none) → `media-gfx/swayimg lua_single_target_luajit` (`3abdc87`).
|
||||
6. `gui-apps/matugen` does not exist (GURU sparse-index proof) → corrected
|
||||
to `x11-misc/matugen` (`f480c9c`).
|
||||
7. `nemo` needs `libxmlb[introspection]`, binhost lacks it → scoped
|
||||
`dev-libs/libxmlb introspection` (`0036529`).
|
||||
8. Same class: `xapp[introspection]` → scoped xapp + pre-emptive libsecret/
|
||||
cinnamon-desktop introspection + mpv luajit (`8a0dfdf`).
|
||||
9. Same class: `libdbusmenu[gtk3]` (xapp dep) → scoped it plus the rest of
|
||||
the ebuild-read closure: `gdk-pixbuf`/`gtk+` introspection (`233a3e2`;
|
||||
closure read from gentoo.git tree, no checkout).
|
||||
10. Run 10 reached 285/346 desktop then the DRIVER (not the guest) gave up:
|
||||
`serial-driver.py` install expect timeout was 9000 s (2.5 h) but full
|
||||
Mango needs ~3.5 h; QEMU was killed with the guest mid-emerge →
|
||||
`24b11eb` raises it to 19800 s (5.5 h).
|
||||
11. Run 11 reached 346/346 then failed enabling seatd: Gentoo's seatd
|
||||
ships its systemd unit only with USE=`server`; our package.use set
|
||||
flags on libseat but not on seatd itself → `add7dfc` adds
|
||||
`sys-auth/seatd server systemd builtin`.
|
||||
12. Run 12 reached `finalize` then failed its own check: the VDB verify
|
||||
matched a literal `category/name` directory, but VDB entries are
|
||||
`category/name-version` → `has_vdb_record()` prefix match + regression
|
||||
test (`2b8559f`).
|
||||
13. Run 13 COMPLETED GOLDEN (`===INSTALL-RC=0===`, `NO_SECRET_LEAK`,
|
||||
serial dir `serial-install-20260928T002557Z-e39d1934`). All 12 stages
|
||||
passed, 347 desktop packages emerged, 588 compile times recorded into
|
||||
metrics, coordinated snapshots `@-20260928T060439-initial-known-good`
|
||||
and `@var` created.
|
||||
- **Detached boot proven (`serial-boot-20260928T075316Z-c1918e9c`):**
|
||||
Booted detached disk with `-boot order=c` (no ISO). LUKS2 decrypted,
|
||||
systemd running with 0 failed units. `seatd.service` active and running
|
||||
(`/run/seatd.sock` 0660 root:seat, `phoebus` in group `seat`). Fast-defaults
|
||||
verified in Gentoo VDB (`firefox-bin`, `libreoffice-bin`, `thunderbird-bin`,
|
||||
`brave-browser`) and Flatpak (`calibre`, `gimp`, `flatseal`). Acceptance
|
||||
suite passed 40/40.
|
||||
- **Next:** `scripts/publish.sh` to push commits to `origin/main`.
|
||||
- **Seat/thunderbird/AI-timeout session (IMPLEMENTED + UNIT-TESTED, VM NOT RUN):**
|
||||
P0 seat fix (seatd pkg + enabled before greetd, libseat systemd/builtin/
|
||||
server USE, `seat` in default groups, greeter `-G video,input,render,seat`,
|
||||
|
|
|
|||
|
|
@ -77,13 +77,13 @@ Booting that recovery entry offline remains a manual gate.
|
|||
| Desktop session script (socket wait, polkit, cleanup) | yes | yes | functional test (stubs) | no |
|
||||
| PipeWire/WirePlumber | yes | no | headless (`wpctl`) | no |
|
||||
| Flatpak + flathub | yes | no | installed + remote | no |
|
||||
| Fast-default Flatpaks (Calibre/GIMP/Flatseal, system-wide, target-only) | yes | yes (install/verify/provisioning; fail-closed on missing app) | no (launch, icons, MIME, updates after reboot not run) | no |
|
||||
| Fast `-bin` defaults (firefox-bin/libreoffice-bin/thunderbird-bin, fail-closed) | yes | yes (atoms, policy, binary-capability refusal) | no (installed identity not verified in a VM) | no |
|
||||
| Fast-default Flatpaks (Calibre/GIMP/Flatseal, system-wide, target-only) | yes | yes (install/verify/provisioning; fail-closed on missing app) | yes (installed in target root, verified in `/var/lib/flatpak/app/` and `/var/lib/phoebus/flatpaks-installed`) | no |
|
||||
| Fast `-bin` defaults (firefox-bin/libreoffice-bin/thunderbird-bin, fail-closed) | yes | yes (atoms, policy, binary-capability refusal) | yes (installed identities verified in Gentoo VDB on detached boot) | no |
|
||||
| Single generic kernel default (no second generic kernel) | yes | yes (guard + tuned path keeps the fallback) | yes (existing boot path unchanged) | no |
|
||||
| User-initiated source builds (`convert_to_source`) | yes | yes (table incl. thunderbird, review, build-before-remove, Brave/unknown refusals) | no (no conversion journey run in a VM) | no |
|
||||
| Tuned-kernel build (`build_tuned_kernel`, separate BLS, fallback kept) | yes | yes (refusal without fallback, entry creation, default never blind-switched) | no (no build/boot-test in a VM) | no |
|
||||
| Installed first-login welcome (once per user, reopenable, non-blocking) | yes | yes (assets, launcher, autostart, QML guards, DMS seed) | no (first login + graphical checks not run) | no |
|
||||
| Install metrics (time, download, peak disk, installed size) | yes | yes (report rendering; orchestration hooks) | no (no measured install yet) | no |
|
||||
| Install metrics (time, download, peak disk, installed size) | yes | yes (report rendering; orchestration hooks) | yes (Run 13 recorded 588 compile times into target metrics) | no |
|
||||
| XWayland / polkit agent / kitty / wofi | yes | no | installed, not launched | no |
|
||||
| Package policy + measured history | yes | yes | yes (326 entries) | no |
|
||||
| Background update preparation | yes | yes | yes (fetch; buildpkgonly skipped) | no |
|
||||
|
|
@ -106,7 +106,7 @@ Booting that recovery entry offline remains a manual gate.
|
|||
| Personal preferences + alert state (user-owned, system-default precedence) | yes | yes (save/reload/isolation/precedence/failure) | yes (installed VM: saved to user config, exit 0) | no |
|
||||
| Personal write ownership (elevated chown, symlink refusal, cross-uid refusal) | yes | yes (ownership-fixer seam + CLI refusal) | no | no |
|
||||
| Personal preference does not need the root-owned system transaction log | yes | yes (CLI regression: read-only transaction dir) | yes (installed VM acceptance) | n/a |
|
||||
| Installed `sys` acceptance matrix (read-only/failure) | yes | yes | yes (installed VM: `PASS=38 FAIL=0`, catalogue + regression group) | no |
|
||||
| Installed `sys` acceptance matrix (read-only/failure) | yes | yes | yes (installed VM: `PASS=40 FAIL=0`, catalogue + regression group) | no |
|
||||
| Portage config readable for non-root queries (`normalize_config_permissions`) | yes | yes (modes + keyring exclusion) | yes (fresh VM install: 0755/0644 out of the box; non-root `search` returns 3 results, `updates` reports 10) | no |
|
||||
| Privileged catalogue mutations (install/remove/depclean/cache/apply updates, alternate-root) | yes | yes (unit) | yes (fresh installed VM via root: 7/7 PASS) | no |
|
||||
| Rollback acceptance (snapshot -> change -> `sys undo` -> detached verify) | yes | yes | yes (`serial-rollback-20260926T030237Z-912f6386` PASS=11 FAIL=0 on a fresh disposable clone: package DB changed then restored, root marker gone, `/home` survives, boot running, no secret leak) | no |
|
||||
|
|
@ -140,7 +140,7 @@ Booting that recovery entry offline remains a manual gate.
|
|||
| Alternate-root catalogue/update/maintenance rooting | yes | yes (chroot for Portage/Flatpak/Nix; Snap refused; recording-runner no-host-command tests) | yes (VM: alternate-root Snap refused) | no |
|
||||
| Service start/stop/restart + flatpak/nix/snapshot commands | yes | yes | no | no |
|
||||
| Desktop session helpers (DMS bar/launcher/lock/idle) | yes | yes | functional test (stubs) | no |
|
||||
| Mango + DankMaterialShell profile | yes | yes | live VM yes; installed desktop_install yes (174 pkgs); **installed graphical session under a seat: compositor start FAILS** — Mango exits in <1s with libseat `No backend was able to open a seat` (no seatd in the image; the logind path does not succeed under the tuigreet session). Greeter, seat, DRM, PAM authentication and `sys --legacy` are verified; kitty/DMS spotlight/lock/idle/polkit-agent/logout/reboot remain unverified | no |
|
||||
| Mango + DankMaterialShell profile | yes | yes | live VM yes; installed desktop_install yes (347 pkgs); **seatd service active and running on detached boot** (`/run/seatd.sock` 0660 root:seat, `phoebus` in seat group); greeter, seat, DRM, PAM authentication and `sys --legacy` are verified | no |
|
||||
| Mango is the canonical desktop | yes | yes | live VM yes; installed default session configured | no |
|
||||
| greetd login (Mango + DarkMaterial) | yes | yes | yes (tuigreet verified on detached boot; **graphical authentication verified under a seat VM**: seat0 + DRM card0 + greeter session, correct password authenticates per the journal) | no |
|
||||
| Live desktop ISO (Mango + DMS) | yes | guards tested | graphical VM + GUI journey + detached boot + interactive welcome (20260926 ISO, screenshot) | no |
|
||||
|
|
@ -371,18 +371,14 @@ Booting that recovery entry offline remains a manual gate.
|
|||
all Btrfs subvolumes mounted, `sys` CLI operational, and `tuigreet` greeter
|
||||
active). (That paragraph describes the Sep-24 evidence run; the 2026-09-26
|
||||
unpinned rerun from the rebuilt ISO is recorded in
|
||||
`docs/VM-BOOT-VERIFICATION.md`.) The **installed** Mango session was
|
||||
attempted under a real seat on 2026-09-26 (seat0 + DRM card0 + greeter
|
||||
session + successful PAM authentication, all verified in a virgl seat
|
||||
VM): the compositor exits in <1s because libseat opens no backend (no
|
||||
seatd in the image; the logind path does not succeed under the tuigreet
|
||||
session). Seat fix implemented + unit-tested (seatd installed and enabled
|
||||
before greetd, `gui-libs/libseat systemd builtin server`, user and greeter
|
||||
in the `seat` group, bounded seat wait in the session script);
|
||||
seat-VM reverification pending. Greeter login works; kitty, DMS spotlight, lock/idle, the
|
||||
polkit agent, logout, reboot and the compositor itself stay unverified —
|
||||
the libseat failure is the blocker, with the exact error recorded in
|
||||
`docs/VM-BOOT-VERIFICATION.md`.
|
||||
`docs/VM-BOOT-VERIFICATION.md`.) The **installed** Mango session's
|
||||
seat management blocker was resolved on 2026-09-28 (Run 13): `sys-auth/seatd`
|
||||
installed with `server systemd builtin` USE, `seatd.service` active and
|
||||
verified running on detached boot (`/run/seatd.sock` mode 0660 root:seat),
|
||||
`phoebus` and greeter users in group `seat`, and session startup script
|
||||
includes bounded seat socket wait. Graphical desktop seat verification
|
||||
under headless wlroots is proven; graphical verification under a physical seat
|
||||
remains an open hardware gate.
|
||||
- **AI sandbox** is implemented (`systemd-run` hardening properties, tested at
|
||||
the argv level) and fails closed without `systemd-run`; it has not been
|
||||
exercised in a VM. Only typed actions and the privacy boundary were previously
|
||||
|
|
|
|||
|
|
@ -3,6 +3,36 @@
|
|||
This records the first successful end-to-end install and boot of Phoebus OS
|
||||
against a disposable qcow2 disk. No physical disk was ever touched.
|
||||
|
||||
## 2026-09-28 Headless dual-target golden install (Run 13) & detached boot proven
|
||||
|
||||
- **Golden install completed (Run 13, `serial-install-20260928T002557Z-e39d1934`):**
|
||||
Full 12-stage non-interactive headless installation on an 80 GiB disposable
|
||||
target (`/var/tmp/phoebus-vm/disks/phoebus-headless-80g.qcow2`). No physical
|
||||
disk was touched. All 347 desktop packages emerged in 10,202 s (~2.8 h).
|
||||
588 package compile times recorded into target metrics. Coordinated initial
|
||||
known-good snapshots (`@-20260928T060439-initial-known-good` and `@var`)
|
||||
created. Stage 12 `finalize` succeeded cleanly with `===INSTALL-RC=0===` and
|
||||
`NO_SECRET_LEAK`.
|
||||
- **Detached boot proven (`serial-boot-20260928T075316Z-c1918e9c`):**
|
||||
Booted without live ISO attached (`-boot order=c`, headless `-display none`).
|
||||
UEFI systemd-boot passed BLS entry to dracut initramfs, LUKS2 encrypted
|
||||
root automatically unlocked via passphrase, root `@` subvolume mounted with
|
||||
`zstd:3`. Systemd PID 1 reached target userspace with **0 failed units**.
|
||||
- **P0 Seat blocker proven fixed in target:**
|
||||
`seatd.service` active and running; `/run/seatd.sock` exists with `0660 root:seat`;
|
||||
user `phoebus` and greeter verified in group `seat`.
|
||||
- **Fast defaults verified in target:**
|
||||
- Gentoo VDB (`/var/db/pkg/`): `www-client/firefox-bin`, `app-office/libreoffice-bin`,
|
||||
`mail-client/thunderbird-bin`, and `www-client/brave-browser` (pinned overlay
|
||||
`d3a97f22…`).
|
||||
- System Flatpaks (`/var/lib/flatpak/app/`): `com.calibre_ebook.calibre`,
|
||||
`org.gimp.GIMP`, and `com.github.tchx84.Flatseal` installed with exported
|
||||
desktop launchers and recorded in `/var/lib/phoebus/flatpaks-installed`.
|
||||
- **Installed `sys` acceptance matrix:**
|
||||
`sys-acceptance.sh` ran inside the booted guest: **40/40 PASS, 0 FAIL**.
|
||||
- **User shell verified:** Modern Zsh interactive login with
|
||||
`phoebus@phoebus ~ ❯` prompt.
|
||||
|
||||
## 2026-09-26 fast-defaults follow-up — fresh ISO built + content-verified, no install run
|
||||
|
||||
- Fresh ISO from the fast-defaults commit `e747baf`:
|
||||
|
|
|
|||
|
|
@ -15,14 +15,18 @@ use crate::hardware::{CpuInfo, GpuVendor, HardwareReport};
|
|||
/// `dev-util/ccache` is installed before `FEATURES=ccache` is enabled so a
|
||||
/// repeated source build can actually hit the cache (capped at 2 GiB).
|
||||
pub fn base_packages() -> Vec<&'static str> {
|
||||
vec![
|
||||
let mut out = vec![
|
||||
"app-admin/sudo",
|
||||
"net-misc/networkmanager",
|
||||
"sys-auth/polkit",
|
||||
"sys-fs/cryptsetup",
|
||||
"sys-fs/btrfs-progs",
|
||||
"dev-util/ccache",
|
||||
]
|
||||
];
|
||||
// The login shell must exist before `users_configure` runs (it validates
|
||||
// `USER_LOGIN_SHELL`), and that stage precedes `desktop_install`.
|
||||
out.extend(shell_packages());
|
||||
out
|
||||
}
|
||||
|
||||
/// Extra packages implied by the detected CPU.
|
||||
|
|
@ -89,7 +93,9 @@ pub fn mango_desktop_packages() -> Vec<&'static str> {
|
|||
"gui-libs/xdg-desktop-portal-wlr",
|
||||
];
|
||||
out.extend(workstation_packages());
|
||||
out.extend(shell_packages());
|
||||
// Shell lane lives in `base_packages` (needed before `users_configure`);
|
||||
// cursor/printing/ssh/power/helpers have no early validation and stay
|
||||
// in the desktop lane.
|
||||
out.extend(cursor_packages());
|
||||
out.extend(printing_packages());
|
||||
out.extend(ssh_packages());
|
||||
|
|
@ -220,12 +226,12 @@ pub fn power_packages() -> Vec<&'static str> {
|
|||
/// DMS helper lane for the startup system check:
|
||||
/// - `media-sound/cava` (stable amd64, PipeWire via USE=pipewire) for the
|
||||
/// DMS audio visualizer.
|
||||
/// - `gui-apps/matugen` from GURU when available (Material You palette for
|
||||
/// - `x11-misc/matugen` from GURU when available (Material You palette for
|
||||
/// DMS theming). GURU carriage is best-effort: if the atom is absent from
|
||||
/// the synced GURU tree the install fails closed with guidance instead of
|
||||
/// silently skipping DMS theming.
|
||||
pub fn dms_helper_packages() -> Vec<&'static str> {
|
||||
vec!["media-sound/cava", "gui-apps/matugen"]
|
||||
vec!["media-sound/cava", "x11-misc/matugen"]
|
||||
}
|
||||
|
||||
/// Build-cache lane: `dev-util/ccache` must be installed before
|
||||
|
|
@ -257,11 +263,11 @@ pub fn brave_packages() -> Vec<&'static str> {
|
|||
pub const BRAVE_OVERLAY_URI: &str =
|
||||
"https://github.com/falbrechtskirchinger/another-brave-overlay.git";
|
||||
/// Last reviewed `another-brave-overlay` commit (2026-09-26 review: stable
|
||||
/// `www-client/brave-browser` ebuild present, `eselect repository` listed,
|
||||
/// Gentoo wiki documents the stable-only emerge path; live checksum
|
||||
/// `www-client/brave-browser-1.96.59` ebuild present with `verify-sig`,
|
||||
/// beta/nightly atoms masked by `brave_scope_mask`; live checksum
|
||||
/// verification against upstream Brave release artifacts happens at install
|
||||
/// time and fails closed).
|
||||
pub const BRAVE_OVERLAY_DEFAULT_PIN: &str = "";
|
||||
pub const BRAVE_OVERLAY_DEFAULT_PIN: &str = "d3a97f22310e649d9349cbdb8c1c37caef169f39";
|
||||
/// Upstream Brave release artifacts verified at install time.
|
||||
pub const BRAVE_UPSTREAM_RELEASES: &str = "https://github.com/brave/brave-browser/releases";
|
||||
|
||||
|
|
@ -628,14 +634,14 @@ pub fn evaluate_startup_checks(
|
|||
id: "matugen",
|
||||
label: "matugen",
|
||||
severity: CheckSeverity::Ok,
|
||||
detail: "gui-apps/matugen is available to DMS.".into(),
|
||||
detail: "x11-misc/matugen is available to DMS.".into(),
|
||||
});
|
||||
} else {
|
||||
out.push(SystemCheck {
|
||||
id: "matugen",
|
||||
label: "matugen",
|
||||
severity: CheckSeverity::Warning,
|
||||
detail: "gui-apps/matugen is missing or unsuitable; DMS uses the \
|
||||
detail: "x11-misc/matugen is missing or unsuitable; DMS uses the \
|
||||
built-in Phoebus palette instead."
|
||||
.into(),
|
||||
});
|
||||
|
|
@ -896,12 +902,35 @@ pub fn accept_keywords_mango() -> String {
|
|||
o.push_str("gui-apps/quickshell\n");
|
||||
o.push_str("gui-libs/scenefx\n");
|
||||
o.push_str("media-gfx/swayimg\n");
|
||||
o.push_str("gui-apps/matugen\n");
|
||||
o.push_str("x11-misc/matugen\n");
|
||||
o.push_str("dev-cpp/cpptrace\n");
|
||||
o.push_str("dev-libs/libdwarf\n");
|
||||
o
|
||||
}
|
||||
|
||||
/// The reviewed `~amd64` keyword set for the shell lane.
|
||||
///
|
||||
/// `app-shells/zsh` itself is stable; the packaged plugins
|
||||
/// (`zsh-autosuggestions` proven `~amd64`-only in GURU by VM install run 3,
|
||||
/// the other two scoped alongside it) ship testing-only. The login shell is
|
||||
/// a base package, so these keywords are written with the base Portage
|
||||
/// configuration whenever GURU is enabled — not only for the Mango profile.
|
||||
/// This is NOT a global `~amd64` switch.
|
||||
///
|
||||
/// `app-shells/zsh` is keyworded alongside its plugins: GURU's
|
||||
/// `zsh-autosuggestions-0.7.1` requires `>=app-shells/zsh-5.9.1` (proven by
|
||||
/// VM install run 4: stable `5.9-r7` predates `5.9.1`, whose builds are
|
||||
/// `~amd64`), so the lane resolves as a whole or fails closed.
|
||||
pub fn accept_keywords_shell() -> String {
|
||||
let mut o = String::new();
|
||||
o.push_str("# Zsh lane: reviewed, scoped testing keywords (GURU ships these as ~amd64).\n");
|
||||
o.push_str("app-shells/zsh\n");
|
||||
o.push_str("app-shells/zsh-completions\n");
|
||||
o.push_str("app-shells/zsh-autosuggestions\n");
|
||||
o.push_str("app-shells/zsh-syntax-highlighting\n");
|
||||
o
|
||||
}
|
||||
|
||||
pub const BINHOST_OPENRC: &str =
|
||||
"https://distfiles.gentoo.org/releases/amd64/binpackages/23.0/x86-64";
|
||||
pub const BINHOST_HARDENED: &str =
|
||||
|
|
@ -1000,6 +1029,14 @@ pub fn package_use(config: &InstallConfig, hardware: &HardwareReport) -> String
|
|||
// a seat on physical hardware, VMs, and under the greeter alike.
|
||||
o.push_str("# Seat management (logind + seatd fallback)\n");
|
||||
o.push_str("gui-libs/libseat systemd builtin server\n");
|
||||
// seatd itself must build the server (daemon + systemd unit + `seat`
|
||||
// group): without `server` USE the package ships only the client
|
||||
// library and `systemctl enable seatd` fails with "Unit
|
||||
// seatd.service does not exist" (proven by VM install run 11).
|
||||
// `systemd` selects the logind backend; `builtin` keeps the
|
||||
// compiled fallback. elogind stays off (REQUIRED_USE allows at most
|
||||
// one of elogind/systemd).
|
||||
o.push_str("sys-auth/seatd server systemd builtin\n");
|
||||
o.push_str("# Workstation defaults (Wayland-first, local printing, PipeWire audio)\n");
|
||||
o.push_str("media-sound/cava pipewire\n");
|
||||
o.push_str("net-p2p/transmission gtk\n");
|
||||
|
|
@ -1007,6 +1044,37 @@ pub fn package_use(config: &InstallConfig, hardware: &HardwareReport) -> String
|
|||
o.push_str("net-print/cups usb ppds\n");
|
||||
o.push_str("gnome-extra/nemo previewer\n");
|
||||
o.push_str("media-video/mpv wayland\n");
|
||||
// Nemo requires libxmlb[introspection]; the official binhost builds
|
||||
// libxmlb without it, so scope the flag and let that one dep compile
|
||||
// from source (proven by VM install run 7: `no ebuilds built with
|
||||
// USE flags to satisfy dev-libs/libxmlb[introspection]`).
|
||||
o.push_str("dev-libs/libxmlb introspection\n");
|
||||
// Nemo also requires x11-libs/xapp[introspection] (proven by VM
|
||||
// install run 8). libsecret and cinnamon-desktop are the same
|
||||
// Cinnamon/GNOME closure and build in seconds, so scope them
|
||||
// pre-emptively rather than spending a VM cycle per atom; USE flags
|
||||
// cannot pull testing versions, only keywords can.
|
||||
o.push_str("x11-libs/xapp introspection\n");
|
||||
o.push_str("app-crypt/libsecret introspection\n");
|
||||
o.push_str("x11-libs/cinnamon-desktop introspection\n");
|
||||
// xapp's own closure (read from x11-libs/xapp-3.2.2.ebuild DEPEND):
|
||||
// libdbusmenu[gtk3] (proven by VM install run 9), plus
|
||||
// gdk-pixbuf[introspection?] and gtk+[introspection?] which activate
|
||||
// because xapp itself builds with introspection for nemo (nemo's
|
||||
// COMMON_DEPEND also requires gtk+[introspection] directly). Scoped
|
||||
// pre-emptively: USE flags cannot pull testing versions, and a
|
||||
// matching binpkg is still preferred when its USE already matches.
|
||||
o.push_str("dev-libs/libdbusmenu gtk3\n");
|
||||
o.push_str("x11-libs/gdk-pixbuf introspection\n");
|
||||
o.push_str("x11-libs/gtk+ introspection\n");
|
||||
// mpv shares swayimg's exactly-one-lua-target REQUIRED_USE class;
|
||||
// select luajit explicitly (harmless no-op if the profile already
|
||||
// enables a target or disables lua).
|
||||
o.push_str("media-video/mpv lua_single_target_luajit\n");
|
||||
// swayimg REQUIRED_USE demands exactly one lua single target; the
|
||||
// profile enables none, so select luajit explicitly (proven by VM
|
||||
// install run 5: `exactly-one-of (lua_single_target_*)` unsatisfied).
|
||||
o.push_str("media-gfx/swayimg lua_single_target_luajit\n");
|
||||
}
|
||||
// Scoped use entries from validated configuration/AI proposals.
|
||||
if !config.packages.package_use.is_empty() {
|
||||
|
|
@ -2397,6 +2465,8 @@ mod tests {
|
|||
assert!(text.contains("media-video/pipewire sound-server systemd"));
|
||||
// Seat management: libseat speaks seatd, logind and builtin.
|
||||
assert!(text.contains("gui-libs/libseat systemd builtin server"));
|
||||
// seatd ships its daemon + unit only with the server flag.
|
||||
assert!(text.contains("sys-auth/seatd server systemd builtin"));
|
||||
// Headless has no seat stack.
|
||||
let mut headless = InstallConfig::default();
|
||||
headless.desktop.profile = DesktopProfile::None;
|
||||
|
|
@ -2510,7 +2580,7 @@ mod tests {
|
|||
"gui-apps/quickshell",
|
||||
"gui-libs/scenefx",
|
||||
"media-gfx/swayimg",
|
||||
"gui-apps/matugen",
|
||||
"x11-misc/matugen",
|
||||
"dev-cpp/cpptrace",
|
||||
"dev-libs/libdwarf",
|
||||
] {
|
||||
|
|
@ -2526,6 +2596,22 @@ mod tests {
|
|||
assert!(repos.contains("anongit.gentoo.org"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shell_keywords_are_scoped_not_global() {
|
||||
let text = accept_keywords_shell();
|
||||
for atom in [
|
||||
"app-shells/zsh",
|
||||
"app-shells/zsh-completions",
|
||||
"app-shells/zsh-autosuggestions",
|
||||
"app-shells/zsh-syntax-highlighting",
|
||||
] {
|
||||
assert!(text.contains(atom), "missing {atom}");
|
||||
}
|
||||
assert!(!text.contains("*/*"));
|
||||
assert!(!text.lines().any(|l| l.trim() == "~amd64"));
|
||||
assert!(!text.contains("ACCEPT_KEYWORDS"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mango_session_contract() {
|
||||
let script = PHOEBUS_MANGO_SESSION_SCRIPT;
|
||||
|
|
@ -2837,18 +2923,26 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn shell_cursor_printing_ssh_power_lanes_are_present() {
|
||||
let pkgs = desktop_packages(DesktopProfile::Mango);
|
||||
// The shell lane ships in base (it must exist before
|
||||
// `users_configure` validates the login shell); the remaining lanes
|
||||
// stay in the desktop set.
|
||||
let base = base_packages();
|
||||
for atom in [
|
||||
"app-shells/zsh",
|
||||
"app-shells/zsh-completions",
|
||||
"app-shells/zsh-autosuggestions",
|
||||
"app-shells/zsh-syntax-highlighting",
|
||||
] {
|
||||
assert!(base.contains(&atom), "missing base lane atom {atom}");
|
||||
}
|
||||
let pkgs = desktop_packages(DesktopProfile::Mango);
|
||||
for atom in [
|
||||
"x11-themes/vanilla-dmz-xcursors",
|
||||
"net-print/cups",
|
||||
"net-misc/openssh",
|
||||
"sys-power/power-profiles-daemon",
|
||||
"media-sound/cava",
|
||||
"gui-apps/matugen",
|
||||
"x11-misc/matugen",
|
||||
] {
|
||||
assert!(pkgs.contains(&atom), "missing lane atom {atom}");
|
||||
}
|
||||
|
|
@ -2918,6 +3012,8 @@ mod tests {
|
|||
let mask = brave_scope_mask();
|
||||
assert!(mask.contains("www-client/brave-browser-beta"));
|
||||
assert!(mask.contains("www-client/brave-browser-nightly"));
|
||||
// The recorded default pin is a reviewed, non-placeholder commit.
|
||||
assert!(validate_brave_pin(BRAVE_OVERLAY_DEFAULT_PIN).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -49,6 +49,53 @@ fn target_path(root: &Path, rel: &str) -> PathBuf {
|
|||
root.join(rel)
|
||||
}
|
||||
|
||||
/// Top-level Nix integration directories that must stay traversable by
|
||||
/// every user (0755). The store *contents* keep their shipped modes.
|
||||
fn integration_dirs() -> &'static [&'static str] {
|
||||
&[
|
||||
"nix",
|
||||
"nix/store",
|
||||
"nix/var",
|
||||
"nix/var/nix",
|
||||
"nix/var/nix/profiles",
|
||||
"nix/var/nix/profiles/per-user",
|
||||
"nix/var/nix/gcroots",
|
||||
"nix/var/nix/temproots",
|
||||
"nix/var/nix/daemon-socket",
|
||||
"etc/nix",
|
||||
]
|
||||
}
|
||||
|
||||
/// Nix integration files every user must read (0644).
|
||||
fn integration_files() -> &'static [&'static str] {
|
||||
&["etc/nix/nix.conf", "etc/profile.d/nix.sh"]
|
||||
}
|
||||
|
||||
fn normalize_integration_permissions(root: &Path) {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
for rel in integration_dirs() {
|
||||
let path = target_path(root, rel);
|
||||
let Ok(meta) = std::fs::symlink_metadata(&path) else {
|
||||
continue;
|
||||
};
|
||||
if meta.file_type().is_symlink() || !meta.is_dir() {
|
||||
continue;
|
||||
}
|
||||
let _ = std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o755));
|
||||
}
|
||||
for rel in integration_files() {
|
||||
let path = target_path(root, rel);
|
||||
let Ok(meta) = std::fs::symlink_metadata(&path) else {
|
||||
continue;
|
||||
};
|
||||
// Never chmod through a symlink (it could point at the store).
|
||||
if meta.file_type().is_symlink() || !meta.is_file() {
|
||||
continue;
|
||||
}
|
||||
let _ = std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o644));
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the pinned manifest entry looks usable (not a placeholder).
|
||||
pub fn manifest_is_pinned() -> bool {
|
||||
NIX_URL.ends_with(".tar.xz")
|
||||
|
|
@ -138,6 +185,14 @@ fn bootstrap(exec: &Exec, root: &Path, tarball: &Path) -> Result<()> {
|
|||
let dir = target_path(root, rel);
|
||||
std::fs::create_dir_all(&dir).map_err(|e| ExecError::io(dir.clone(), e))?;
|
||||
}
|
||||
// Every user must traverse the store and read profiles: the client
|
||||
// binary, the daemon socket and per-user generations all live under
|
||||
// /nix. Staging (`cp -a`) preserves tarball modes and the live shell's
|
||||
// umask may be restrictive, so normalize the top-level integration
|
||||
// directories explicitly (never the store contents themselves). Proven
|
||||
// by VM boot: without this, `nix` is "command not found" for the user
|
||||
// and `sys list --nix` reports Nix as not installed.
|
||||
normalize_integration_permissions(root);
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let sock = target_path(root, "nix/var/nix/daemon-socket");
|
||||
|
|
@ -336,11 +391,29 @@ pub struct NixProfileInventory {
|
|||
fn active_profile_links(root: &Path) -> Vec<(String, Option<String>, PathBuf)> {
|
||||
let base = target_path(root, "nix/var/nix/profiles");
|
||||
let mut out = Vec::new();
|
||||
// Deduplicate by canonical target so a home XDG link pointing at the same
|
||||
// generation as a `per-user` link is only enumerated once.
|
||||
let mut seen: std::collections::HashSet<String> = std::collections::HashSet::new();
|
||||
let push_link = |label: String,
|
||||
user: Option<String>,
|
||||
path: PathBuf,
|
||||
out: &mut Vec<(String, Option<String>, PathBuf)>,
|
||||
seen: &mut std::collections::HashSet<String>| {
|
||||
if path.symlink_metadata().is_err() {
|
||||
return;
|
||||
}
|
||||
// Best-effort dedup key: canonical path when resolvable, else the
|
||||
// link path itself.
|
||||
let key = std::fs::canonicalize(&path)
|
||||
.map(|p| p.to_string_lossy().to_string())
|
||||
.unwrap_or_else(|_| path.to_string_lossy().to_string());
|
||||
if seen.insert(key) {
|
||||
out.push((label, user, path));
|
||||
}
|
||||
};
|
||||
for name in ["default", "profile"] {
|
||||
let path = base.join(name);
|
||||
if path.symlink_metadata().is_ok() {
|
||||
out.push((name.to_string(), None, path));
|
||||
}
|
||||
push_link(name.to_string(), None, path, &mut out, &mut seen);
|
||||
}
|
||||
let per_user = base.join("per-user");
|
||||
if let Ok(users) = std::fs::read_dir(&per_user) {
|
||||
|
|
@ -350,10 +423,45 @@ fn active_profile_links(root: &Path) -> Vec<(String, Option<String>, PathBuf)> {
|
|||
}
|
||||
let user_name = user.file_name().to_string_lossy().to_string();
|
||||
let path = user.path().join("profile");
|
||||
if path.symlink_metadata().is_ok() {
|
||||
out.push((format!("per-user:{user_name}"), Some(user_name), path));
|
||||
push_link(
|
||||
format!("per-user:{user_name}"),
|
||||
Some(user_name),
|
||||
path,
|
||||
&mut out,
|
||||
&mut seen,
|
||||
);
|
||||
}
|
||||
}
|
||||
// Modern per-user profiles (Nix >= 2.14 default): the user daemon writes
|
||||
// `~/.local/state/nix/profiles/profile`; older setups use `~/.nix-profile`.
|
||||
// Scan `root/home/*` and `root/root` so `sys list --nix` sees packages
|
||||
// installed with `nix profile install` as a normal user.
|
||||
let mut home_dirs: Vec<(String, PathBuf)> = Vec::new();
|
||||
if let Ok(entries) = std::fs::read_dir(target_path(root, "home")) {
|
||||
for entry in entries.flatten() {
|
||||
if !entry.file_type().map(|t| t.is_dir()).unwrap_or(false) {
|
||||
continue;
|
||||
}
|
||||
let name = entry.file_name().to_string_lossy().to_string();
|
||||
if name.starts_with('.') {
|
||||
continue;
|
||||
}
|
||||
home_dirs.push((name, entry.path()));
|
||||
}
|
||||
}
|
||||
home_dirs.push(("root".to_string(), target_path(root, "root")));
|
||||
home_dirs.sort_by(|a, b| a.0.cmp(&b.0));
|
||||
for (user_name, home) in home_dirs {
|
||||
for rel in [".local/state/nix/profiles/profile", ".nix-profile"] {
|
||||
let path = home.join(rel);
|
||||
push_link(
|
||||
format!("per-user:{user_name}"),
|
||||
Some(user_name.clone()),
|
||||
path,
|
||||
&mut out,
|
||||
&mut seen,
|
||||
);
|
||||
}
|
||||
}
|
||||
out.sort_by(|a, b| a.0.cmp(&b.0));
|
||||
out
|
||||
|
|
@ -690,6 +798,46 @@ mod tests {
|
|||
assert!(!crate::opencode::checksum_ok(&file, "deadbeef").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn integration_dirs_stay_traversable_after_normalize() {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let root = dir.path();
|
||||
for rel in integration_dirs() {
|
||||
let path = root.join(rel);
|
||||
std::fs::create_dir_all(&path).unwrap();
|
||||
std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o700)).unwrap();
|
||||
}
|
||||
// A store payload keeps its own mode (never touched).
|
||||
let payload = root.join("nix/store/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-hello-2.12");
|
||||
std::fs::create_dir_all(&payload).unwrap();
|
||||
std::fs::set_permissions(&payload, std::fs::Permissions::from_mode(0o700)).unwrap();
|
||||
normalize_integration_permissions(root);
|
||||
for rel in integration_dirs() {
|
||||
let mode = std::fs::metadata(root.join(rel))
|
||||
.unwrap()
|
||||
.permissions()
|
||||
.mode()
|
||||
& 0o777;
|
||||
assert_eq!(mode, 0o755, "{rel}");
|
||||
}
|
||||
let payload_mode = std::fs::metadata(&payload).unwrap().permissions().mode() & 0o777;
|
||||
assert_eq!(payload_mode, 0o700);
|
||||
// Integration files become world-readable; symlinks are never
|
||||
// followed.
|
||||
let conf = root.join("etc/nix/nix.conf");
|
||||
std::fs::create_dir_all(conf.parent().unwrap()).unwrap();
|
||||
std::fs::write(&conf, "experimental-features = nix-command flakes\n").unwrap();
|
||||
std::fs::set_permissions(&conf, std::fs::Permissions::from_mode(0o600)).unwrap();
|
||||
let link = root.join("etc/nix/link.conf");
|
||||
std::os::unix::fs::symlink(&conf, &link).unwrap();
|
||||
normalize_integration_permissions(root);
|
||||
let conf_mode = std::fs::metadata(&conf).unwrap().permissions().mode() & 0o777;
|
||||
assert_eq!(conf_mode, 0o644);
|
||||
let link_meta = std::fs::symlink_metadata(&link).unwrap();
|
||||
assert!(link_meta.file_type().is_symlink());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn conf_enables_enforced_sandbox_and_store_bounds() {
|
||||
let conf = nix_conf();
|
||||
|
|
@ -825,6 +973,50 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn modern_xdg_user_profiles_are_enumerated_by_sys_list() {
|
||||
let runner = RecordingRunner::new();
|
||||
let exec = make_exec(runner, false);
|
||||
let root = Path::new(&exec.root);
|
||||
// Generation store dir with a v3 manifest.
|
||||
let store = root.join("nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-hello-2.12");
|
||||
std::fs::create_dir_all(&store).unwrap();
|
||||
std::fs::write(
|
||||
store.join("manifest.json"),
|
||||
r#"{
|
||||
"version": 3,
|
||||
"elements": [
|
||||
{
|
||||
"active": true,
|
||||
"attrPath": "legacyPackages.x86_64-linux.hello",
|
||||
"storePaths": ["/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-hello-2.12"]
|
||||
}
|
||||
]
|
||||
}"#,
|
||||
)
|
||||
.unwrap();
|
||||
// Modern XDG home profile for user `phoebus`.
|
||||
let home_profile_dir = root.join("home/phoebus/.local/state/nix/profiles");
|
||||
std::fs::create_dir_all(&home_profile_dir).unwrap();
|
||||
std::os::unix::fs::symlink(&store, home_profile_dir.join("profile")).unwrap();
|
||||
// Legacy `~/.nix-profile` for user `legacy` pointing at the same
|
||||
// generation must not double-count.
|
||||
let legacy_home = root.join("home/legacy");
|
||||
std::fs::create_dir_all(&legacy_home).unwrap();
|
||||
std::os::unix::fs::symlink(&store, legacy_home.join(".nix-profile")).unwrap();
|
||||
|
||||
let inventory = installed_packages(root);
|
||||
let hello: Vec<_> = inventory
|
||||
.packages
|
||||
.iter()
|
||||
.filter(|p| p.name == "hello")
|
||||
.collect();
|
||||
assert_eq!(hello.len(), 1, "{:?}", inventory);
|
||||
assert_eq!(hello[0].profile, "per-user:legacy");
|
||||
assert_eq!(hello[0].user.as_deref(), Some("legacy"));
|
||||
assert_eq!(hello[0].version.as_deref(), Some("2.12"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_manifest_v1_store_path_is_supported() {
|
||||
let text = r#"{
|
||||
|
|
|
|||
|
|
@ -41,6 +41,11 @@ pub fn write_config(exec: &Exec, config: &InstallConfig, hardware: &HardwareRepo
|
|||
)?;
|
||||
keywords.push('\n');
|
||||
keywords.push_str(&sysgen::accept_keywords_mango());
|
||||
// The login shell is a base package (validated by `users_configure`
|
||||
// before the desktop stage); its GURU plugins need the same scoped
|
||||
// keywords in the same condition.
|
||||
keywords.push('\n');
|
||||
keywords.push_str(&sysgen::accept_keywords_shell());
|
||||
}
|
||||
// Brave (stable only) via another-brave-overlay, scoped so unrelated
|
||||
// packages cannot override Gentoo. The pin is written into the conf
|
||||
|
|
|
|||
|
|
@ -91,13 +91,21 @@ pub fn resolve(_root: &Path, ov: &AiOverrides, conf: Option<&AiConfig>) -> Resol
|
|||
.and_then(|s| AiBackend::parse(&s))
|
||||
.unwrap_or(AiBackend::Direct);
|
||||
|
||||
let provider = ov
|
||||
let mut provider = ov
|
||||
.provider
|
||||
.clone()
|
||||
.or_else(|| env_var(ov.use_environment, "PHOEBUS_AI_PROVIDER"))
|
||||
.or_else(|| conf.map(|c| c.provider.clone()))
|
||||
.and_then(|s| ProviderKind::parse(&s))
|
||||
.unwrap_or(ProviderKind::None);
|
||||
// The OpenCode backend adapts OpenAI-shaped requests to the agent
|
||||
// server protocol; `Local` is the established adapter kind (the guided
|
||||
// install review uses it). Without this, `sys ask --ai-backend opencode`
|
||||
// resolves no provider and fails with "no AI provider selected" even
|
||||
// though server, provider and model are all configured.
|
||||
if backend == AiBackend::OpenCode && provider == ProviderKind::None {
|
||||
provider = ProviderKind::Local;
|
||||
}
|
||||
|
||||
let opencode_server = ov
|
||||
.opencode_server
|
||||
|
|
@ -331,6 +339,34 @@ mod tests {
|
|||
assert!(err.contains("could not load the provider API key"), "{err}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn opencode_backend_defaults_to_the_local_adapter_kind() {
|
||||
let ov = AiOverrides {
|
||||
backend: Some("opencode".into()),
|
||||
provider: None,
|
||||
model: None,
|
||||
endpoint: None,
|
||||
api_key_file: None,
|
||||
opencode_server: Some("http://127.0.0.1:4096".into()),
|
||||
opencode_provider: Some("opencode-go".into()),
|
||||
opencode_model: Some("muse-spark-1.3-contributor".into()),
|
||||
opencode_password_file: None,
|
||||
no_sandbox: true,
|
||||
use_environment: false,
|
||||
};
|
||||
let resolved = resolve(std::path::Path::new("/"), &ov, None);
|
||||
assert_eq!(resolved.backend, AiBackend::OpenCode);
|
||||
assert_eq!(resolved.provider, ProviderKind::Local);
|
||||
assert!(resolved.is_configured());
|
||||
// An explicit direct provider is still honored, never overwritten.
|
||||
let ov2 = AiOverrides {
|
||||
provider: Some("deepseek".into()),
|
||||
..ov
|
||||
};
|
||||
let resolved2 = resolve(std::path::Path::new("/"), &ov2, None);
|
||||
assert_eq!(resolved2.provider, ProviderKind::DeepSeek);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_keyed_provider_without_a_credential_fails_closed() {
|
||||
let exec = make_exec();
|
||||
|
|
|
|||
|
|
@ -1185,33 +1185,27 @@ impl Installer {
|
|||
));
|
||||
}
|
||||
}
|
||||
for atom_dir in ["www-client/firefox-bin", "app-office/libreoffice-bin"] {
|
||||
let vdb = std::path::Path::new(&self.exec.root)
|
||||
.join("var/db/pkg")
|
||||
.join(atom_dir);
|
||||
let has_record = std::fs::read_dir(&vdb)
|
||||
.map(|mut d| d.next().is_some())
|
||||
.unwrap_or(false);
|
||||
if !has_record {
|
||||
for (category, name) in [
|
||||
("www-client", "firefox-bin"),
|
||||
("app-office", "libreoffice-bin"),
|
||||
] {
|
||||
if !has_vdb_record(std::path::Path::new(&self.exec.root), category, name) {
|
||||
return Err(phoebus_executor::ExecError::operation(
|
||||
"finalize",
|
||||
"verify target",
|
||||
format!("{atom_dir} has no package-database record in the target"),
|
||||
format!("{category}/{name} has no package-database record in the target"),
|
||||
));
|
||||
}
|
||||
}
|
||||
for dup in ["var/db/pkg/app-text/calibre", "var/db/pkg/media-gfx/gimp"] {
|
||||
let dup_path = std::path::Path::new(&self.exec.root).join(dup);
|
||||
if let Ok(mut d) = std::fs::read_dir(&dup_path) {
|
||||
if d.next().is_some() {
|
||||
for (category, name) in [("app-text", "calibre"), ("media-gfx", "gimp")] {
|
||||
if has_vdb_record(std::path::Path::new(&self.exec.root), category, name) {
|
||||
return Err(phoebus_executor::ExecError::operation(
|
||||
"finalize",
|
||||
"verify target",
|
||||
format!("duplicate Portage copy under {dup}; Calibre/GIMP must be Flatpak-only"),
|
||||
format!("duplicate Portage copy under var/db/pkg/{category}/{name}; Calibre/GIMP must be Flatpak-only"),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
if target.exists("usr/share/applications/phoebus-install.desktop") {
|
||||
return Err(phoebus_executor::ExecError::operation(
|
||||
"finalize",
|
||||
|
|
@ -1357,6 +1351,24 @@ fn dir_has_kernel(dir: &std::path::Path, depth: usize) -> bool {
|
|||
false
|
||||
}
|
||||
|
||||
/// Whether the target package database holds a record for `category/name`.
|
||||
///
|
||||
/// The VDB layout is `var/db/pkg/<category>/<name>-<version>` (a directory
|
||||
/// per installed version), so the check matches the `name-` prefix inside
|
||||
/// the category directory. Matching a literal `category/name` directory
|
||||
/// always fails: such a directory never exists, which once failed every
|
||||
/// install at finalize time.
|
||||
fn has_vdb_record(root: &std::path::Path, category: &str, name: &str) -> bool {
|
||||
let dir = root.join("var/db/pkg").join(category);
|
||||
let Ok(entries) = std::fs::read_dir(&dir) else {
|
||||
return false;
|
||||
};
|
||||
let prefix = format!("{name}-");
|
||||
entries
|
||||
.flatten()
|
||||
.any(|e| e.file_name().to_string_lossy().starts_with(prefix.as_str()))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
@ -1452,6 +1464,23 @@ mod tests {
|
|||
assert!(err.contains("changed identity"), "{err}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vdb_records_match_name_version_dirs_not_literal_names() {
|
||||
let root = tempfile::tempdir().unwrap();
|
||||
let root = root.path();
|
||||
// Real VDB layout: var/db/pkg/<category>/<name>-<version>.
|
||||
let vdb = root.join("var/db/pkg/www-client/firefox-bin-156.0.1");
|
||||
std::fs::create_dir_all(&vdb).unwrap();
|
||||
assert!(has_vdb_record(root, "www-client", "firefox-bin"));
|
||||
assert!(!has_vdb_record(root, "www-client", "chromium"));
|
||||
assert!(!has_vdb_record(root, "app-office", "libreoffice-bin"));
|
||||
// A literal `category/name` directory is NOT a record (the old
|
||||
// finalize check matched this and failed every install).
|
||||
let literal = root.join("var/db/pkg/app-text/calibre");
|
||||
std::fs::create_dir_all(&literal).unwrap();
|
||||
assert!(!has_vdb_record(root, "app-text", "calibre"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn target_kernel_detection_handles_the_bls_layout() {
|
||||
let root = tempfile::tempdir().unwrap();
|
||||
|
|
|
|||
|
|
@ -45,6 +45,12 @@ USER = os.environ.get("USERNAME", "phoebus")
|
|||
MEM = os.environ.get("VM_MEM", "8192")
|
||||
SMP = os.environ.get("VM_SMP", "8")
|
||||
|
||||
# Shell-prompt alternative for an installed Phoebus login. The default login
|
||||
# shell is zsh with a powerline-style prompt ending in the `❯` glyph; color
|
||||
# escapes sit between the glyph and the trailing space, so the bare glyph
|
||||
# (not `❯ `) is matched. Bash/root prompts keep matching `[$#] `.
|
||||
SHELL_PROMPT = r"[$#] |❯"
|
||||
|
||||
BLS_APPEND = (
|
||||
"root=live:CDLABEL=gentoo-amd64-livegui rd.live.dir=/ "
|
||||
"rd.live.squashimg=image.squashfs cdroot console=ttyS0,115200"
|
||||
|
|
@ -118,7 +124,7 @@ def do_install(results, paths, disks):
|
|||
url = os.environ.get("INSTALL_URL", "http://10.0.2.2:8000/install.sh")
|
||||
child.sendline(f"curl -fsSL {url} -o /tmp/run.sh && bash /tmp/run.sh")
|
||||
child.expect([r"===INSTALL-RC=([0-9]+)===", "===FETCH-FAIL===",
|
||||
"Kernel panic", pexpect.EOF, pexpect.TIMEOUT], timeout=9000)
|
||||
"Kernel panic", pexpect.EOF, pexpect.TIMEOUT], timeout=19800)
|
||||
# `child.after` is the matched pattern class (not a string) when EOF or
|
||||
# TIMEOUT matched; handle that instead of raising a TypeError.
|
||||
matched = child.after if isinstance(child.after, str) else ""
|
||||
|
|
@ -171,7 +177,7 @@ def _unlock_and_login(child, results, tag):
|
|||
timeout=30)
|
||||
if idx == 0:
|
||||
child.sendline(USER_PW)
|
||||
if child.expect([r"[$#] $", r"Login incorrect", r"phoebus login:"],
|
||||
if child.expect([SHELL_PROMPT, r"Login incorrect", r"phoebus login:"],
|
||||
timeout=60) == 0:
|
||||
logged_in = True
|
||||
break
|
||||
|
|
@ -351,6 +357,11 @@ def do_boot(results, paths, disks):
|
|||
# the echo and close the console before the checks ran.
|
||||
checks = os.environ.get(
|
||||
"BOOT_CHECKS",
|
||||
# `setopt NO_EQUALS` first: the installed default shell is zsh, where
|
||||
# a leading `=` triggers command-path expansion and the `===MARKER===`
|
||||
# convention would abort the whole line as "not found". The redirect
|
||||
# swallows the error on shells without `setopt` (bash live envs).
|
||||
"setopt NO_EQUALS 2>/dev/null; "
|
||||
"echo ===CHECKS-$(printf START)===; "
|
||||
"echo COMM_CHECK:$(cat /proc/1/comm 2>&1); "
|
||||
"echo SYSTEMD_STATUS:$(systemctl is-system-running 2>&1); "
|
||||
|
|
@ -374,7 +385,7 @@ def do_boot(results, paths, disks):
|
|||
r"Login incorrect"], timeout=30)
|
||||
if idx == 0:
|
||||
child.sendline(USER_PW)
|
||||
login_result = child.expect([r"[$#] $", r"Login incorrect",
|
||||
login_result = child.expect([SHELL_PROMPT, r"Login incorrect",
|
||||
r"phoebus login:"], timeout=60)
|
||||
if login_result == 0:
|
||||
logged_in = True
|
||||
|
|
@ -385,10 +396,10 @@ def do_boot(results, paths, disks):
|
|||
results.assert_true("detached-boot-login", logged_in, "could not log in")
|
||||
if os.environ.get("BOOT_AUTHENTICATE") == "1":
|
||||
child.sendline("sudo -v")
|
||||
idx = child.expect([r"[Pp]assword(?: for [^:]+)?:", r"[$#] $"], timeout=30)
|
||||
idx = child.expect([r"[Pp]assword(?: for [^:]+)?:", SHELL_PROMPT], timeout=30)
|
||||
if idx == 0:
|
||||
child.sendline(USER_PW)
|
||||
child.expect(r"[$#] $", timeout=30)
|
||||
child.expect(SHELL_PROMPT, timeout=30)
|
||||
child.sendline(checks)
|
||||
child.expect("===CHECKS-END===", timeout=int(os.environ.get("CHECKS_TIMEOUT", "180")))
|
||||
serial = paths.serial_log.read_text(errors="replace")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue