fix(sys): make Snap first-use setup reviewable and VM-tested
Some checks are pending
ci / test (push) Waiting to run
Some checks are pending
ci / test (push) Waiting to run
This commit is contained in:
parent
3bdeb08f76
commit
7c5d4c5ca6
14 changed files with 426 additions and 86 deletions
|
|
@ -3,6 +3,32 @@
|
|||
All notable changes are recorded here. The authoritative history is `git log`;
|
||||
this file is the curated, human-readable summary.
|
||||
|
||||
## 2026-09-25 — Make first-use Snap setup reviewable and fix Portage target selection
|
||||
|
||||
- The normal Snap install now explains the separate, reviewed Portage install of
|
||||
`app-containers/snapd` and the socket enable/start steps when the daemon is
|
||||
absent. A raw typed `snap_install` no longer adds snapd behind the review.
|
||||
- Fresh installs include scoped `sys-fs/squashfs-tools lzma lzo` USE flags,
|
||||
which Gentoo's snapd ebuild requires. Existing installed images need the same
|
||||
scoped setting before the Portage step.
|
||||
- Portage candidate resolution matches the requested atom in a multi-package
|
||||
pretend plan. The prior first-line selection could install a dependency
|
||||
(`dev-lang/go-bootstrap` in the Snap VM) instead of `app-containers/snapd`.
|
||||
- Snap candidate sandbox levels now use the daemon's detected confinement;
|
||||
missing `snap info` confinement is not assumed to be strict.
|
||||
- Regression tests cover the prerequisite gate, Portage target selection and
|
||||
confinement mapping. The disposable VM exposed both the missing scoped USE
|
||||
flags and the first-dependency selection bug. After those fixes, the installed
|
||||
VM completed the reviewed snapd install, enabled and started `snapd.socket`,
|
||||
installed `hello-world` from the Snap Store, ran refresh, and removed it
|
||||
(`serial-boot ...107996de`, `PASS=10 FAIL=0`). The daemon reported **partial**
|
||||
confinement and the plan displayed partial, not strong. The refresh command
|
||||
succeeded with no newer revision available. A fresh overlay using the final
|
||||
static binary passed the same journey with clean poweroff (`...c024cc43`,
|
||||
`PASS=11 FAIL=0`); a clean reboot and repeat also passed (`...e6193c3a`,
|
||||
`PASS=11 FAIL=0`). A revision-changing refresh and strict AppArmor
|
||||
confinement remain unverified.
|
||||
|
||||
## 2026-09-25 — Second-round `sys` fixes: safe cleanup previews, exact update transactions, reverse dependencies
|
||||
|
||||
Follow-up review found three further confirmed defects; all three are fixed with
|
||||
|
|
|
|||
|
|
@ -3,7 +3,23 @@
|
|||
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.
|
||||
|
||||
- **Last updated:** this session (2026-09-25), second-round `sys` review fixes.
|
||||
- **Snap first-use follow-up (2026-09-25):** the previous "no snapd" note was a
|
||||
real integration gap. The normal `sys install … --legacy --snap` resolver needs
|
||||
snapd to confirm a Store candidate before approval, while a raw typed
|
||||
`snap_install` silently added it during execution. First-use setup is now a
|
||||
separately reviewed Portage install plus socket enable/start, with exact
|
||||
guidance when absent. Fresh installs set scoped
|
||||
`sys-fs/squashfs-tools lzma lzo`, which Gentoo's snapd ebuild requires.
|
||||
A disposable VM exposed a second bug: Portage candidate resolution picked
|
||||
the first dependency (`dev-lang/go-bootstrap`) instead of the requested
|
||||
`app-containers/snapd`; it now matches the requested atom. Snap confinement
|
||||
is reported from the daemon rather than assumed strict. The disposable VM
|
||||
completed setup, Store install, refresh and remove (`PASS=10 FAIL=0`), with
|
||||
partial confinement. A fresh overlay and a clean reboot repeat with the final
|
||||
static binary each passed `PASS=11 FAIL=0`, including clean poweroff. Refresh
|
||||
found no newer revision.
|
||||
|
||||
- **Previous session:** second-round `sys` review fixes.
|
||||
Follow-up to `d3f676a`. Three further confirmed defects are fixed with
|
||||
regression tests: unsafe cleanup previews, non-exact Flatpak/Snap update
|
||||
execution, and reverse-dependency self-reference. `make test` is green
|
||||
|
|
@ -14,7 +30,20 @@ commit it. It should be short and current; use `git log` for detail.
|
|||
never bypass it; a missing model stops the workflow and offers the exact
|
||||
`--legacy` command without executing it.
|
||||
|
||||
## What this session changed (code)
|
||||
## Snap first-use changes
|
||||
|
||||
- `phoebus-core::system` generates scoped SquashFS USE flags for new installs.
|
||||
- Portage candidate resolution selects the requested atom from the pretend
|
||||
plan, even when dependencies precede it. A multi-package regression covers
|
||||
the bug found by the VM.
|
||||
- The Snap install path gives exact setup commands when snapd is absent; the
|
||||
typed action no longer adds an unreviewed Portage dependency. Candidate
|
||||
sandbox levels and missing `snap info` fields are treated conservatively.
|
||||
- `installer/tests/vm/snap-guest.sh` drives the installed-system journey. The
|
||||
serial driver can authenticate for boot checks and logs only guest output,
|
||||
keeping sent test passwords out of its transcript.
|
||||
|
||||
## Previous sys review work
|
||||
|
||||
1. **Cleanup previews are non-destructive (finding 1).** `eclean-dist`/
|
||||
`eclean-pkg` delete by default, so `portage_cleaners` now previews with
|
||||
|
|
@ -65,12 +94,21 @@ commit it. It should be short and current; use `git log` for detail.
|
|||
- **Read-only acceptance:** `installer/tests/vm/sys-acceptance.sh` `PASS=38
|
||||
FAIL=0` re-run against the final static `sys` (`dd61c610…`), including the new
|
||||
`rdeps-legacy` reverse-dependency regression.
|
||||
- **Snap first use:** the disposable VM installed `app-containers/snapd` through
|
||||
the reviewed Portage plan (six effects), enabled and started `snapd.socket`,
|
||||
installed Snap Store `hello-world` 6.4 revision 29, ran refresh, then removed
|
||||
it. The daemon reported `partial` confinement and the install review agreed.
|
||||
The harness reported `PASS=10 FAIL=0`
|
||||
(`serial-boot-20260926T001830Z-107996de`).
|
||||
Final-binary runs on a fresh overlay passed `PASS=11 FAIL=0` on first boot
|
||||
(`serial-boot-20260926T005327Z-c024cc43`) and after a clean reboot
|
||||
(`serial-boot-20260926T010605Z-e6193c3a`); both shut down cleanly.
|
||||
|
||||
## Not completed / blocked
|
||||
|
||||
- **Snap install/refresh/remove:** no snapd in the image. Prerequisite:
|
||||
`app-containers/snapd` + AppArmor + network, installed through the supported
|
||||
integration. The Snap transaction code is unit-tested only.
|
||||
- **Snap update to a different revision / strict confinement:** refresh with no
|
||||
newer revision and partial confinement were VM-verified. A revision-changing
|
||||
refresh and AppArmor-backed strict confinement were not.
|
||||
- **Live AI:** a local OpenAI-compatible model (`llama-server` + a GGUF model)
|
||||
was served on the host; the AI workflow reached the model, but the sandboxed
|
||||
call exceeded the 120 s transport timeout on CPU (`curl` exit 28). Needs a
|
||||
|
|
@ -95,12 +133,12 @@ commit it. It should be short and current; use `git log` for detail.
|
|||
|
||||
## Next actions (in order)
|
||||
|
||||
1. **Snap lane acceptance** with `app-containers/snapd` (install/refresh/remove,
|
||||
confinement recorded).
|
||||
2. **Recovery boot** by selecting the recovery BLS entry with the network down.
|
||||
3. **Live AI** with a faster local model/GPU or an authorized provider
|
||||
1. **Recovery boot** by selecting the recovery BLS entry with the network down.
|
||||
2. **Live AI** with a faster local model/GPU or an authorized provider
|
||||
credential (natural-language discovery, source constraints, reviewed install).
|
||||
4. **Nix profile GC stability** if the dangling re-run is reproducible.
|
||||
3. **Nix profile GC stability** if the dangling re-run is reproducible.
|
||||
4. **Snap strict confinement and changed-revision update** in a disposable VM
|
||||
when an AppArmor-ready kernel and a revision-changing Store test are available.
|
||||
|
||||
## Definition of a good stopping point
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ more interesting. Status vocabulary: **Done**, **Partial**, **Next**, **Later**.
|
|||
| — | Graphical installer (welcome + wizard) | Partial | Quickshell/QML over the typed `--gui-bridge`; live graphical VM verified, including a detached install+boot; live AI call pending (ADR 0010) |
|
||||
| — | AI-guided install optimization | Partial | DeepSeek/OpenAI/local providers, evidence-gated typed review, mandatory at install with `--no-ai` break-glass; fixture-verified, no live call |
|
||||
| — | Nix as a built-in second lane | Partial | pinned-release bootstrap; `nix-daemon` active and `nix shell nixpkgs#hello` VM-verified; on by default |
|
||||
| — | Hardware-aware software selection (all lanes) | Partial | shared policy + candidate resolution + `choose_package`/`set_package_preference` (unit-tested); Snap, AppImage and custom-ebuild backends implemented (unit-tested); VM journeys pending (ADR 0006 revised) |
|
||||
| — | Hardware-aware software selection (all lanes) | Partial | shared policy + candidate resolution + `choose_package`/`set_package_preference` (unit-tested); Snap first-use/install/refresh/remove, AppImage and custom-ebuild journeys VM-verified; strict Snap confinement and changed-revision update remain (ADR 0006 revised) |
|
||||
| — | AI-first package administration | Done | unified CLI (`sys install`, `please`, `ask`) and desktop GUI (`phoebus-assistant`) backed by shared `service::*` planning, `PreparedPlan` digests with replay protection, Polkit elevation, QML provisioning, conversation continuity (`conversation::*`), Nix attribute verification, Portage binhost checks, and cross-source removal |
|
||||
| — | Git workflow + agent guide | Done | this `docs/` set, `.githooks/`, `scripts/` |
|
||||
|
||||
|
|
@ -44,11 +44,11 @@ more interesting. Status vocabulary: **Done**, **Partial**, **Next**, **Later**.
|
|||
4. **Binary strategy**: keep the official signed binhost for packages whose USE
|
||||
matches and use Flatpak/Nix for other binaries; do not publish a private
|
||||
Gentoo binhost (ADR 0006). Verify with `emerge -pv` and record reuse.
|
||||
5. **Lane acceptance in the disposable VM**: run the `sys` acceptance matrix
|
||||
(`installer/tests/vm/sys-acceptance.sh`) on a booted installed disk, then a
|
||||
Snap install/refresh/remove, an AppImage acquire/launch/remove, and one
|
||||
custom-ebuild build (`docs/SYS.md`). This is the remaining proof for the new
|
||||
lanes and the installed-`sys` lifecycle.
|
||||
5. **Lane follow-up in the disposable VM**: the installed `sys` matrix,
|
||||
Snap first-use/install/refresh/remove, AppImage acquire/launch/remove, and
|
||||
custom-ebuild build now have VM evidence. Exercise an actual Snap revision
|
||||
change and strict AppArmor confinement when suitable fixtures are available
|
||||
(`docs/SYS.md`).
|
||||
6. **Live AI provider call**: exercise `sys ask` and the installer guided path
|
||||
with a real 0600 key file; the path is currently fixture-verified only, and
|
||||
the `systemd-run` sandbox is not yet VM-verified.
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ still not VM-verified.
|
|||
| Transaction log (outcomes, protective snapshots) | yes | yes | read-only in installed VM; write path needs root | no |
|
||||
| Flatpak/Nix bounded typed actions | yes | yes | no | no |
|
||||
| Shared hardware-aware source selection (all lanes) | yes | yes | no | no |
|
||||
| Snap lane (detect/install/list/remove/refresh/connections) | yes | yes (incl. exact revisions) | no (no snapd in the image; needs `app-containers/snapd`, AppArmor, network) | no |
|
||||
| Snap lane (detect/install/list/remove/refresh/connections) | yes (reviewed first-use setup) | yes (incl. exact revisions and confinement) | partial (VM: Portage snapd, active socket, `hello-world` install/list/refresh/remove; partial confinement; refresh had no newer revision; connections not exercised) | no |
|
||||
| AppImage lane (import/acquire/integrity/desktop/remove) | yes | yes | yes (VM: acquire with pinned SHA, list, launch fixture, remove; tampered SHA refused) | no |
|
||||
| Custom ebuild overlay (stage/approve/build/remove) | yes | yes | yes (VM: stage → build/install → VDB+file present → remove) | no |
|
||||
| `sys` installed into the target + verified in chroot | yes | yes (unit) | yes (detached boot verified) | no |
|
||||
|
|
@ -120,7 +120,7 @@ still not VM-verified.
|
|||
| Unified package search (`sys search`, all lanes, `--legacy`) | yes | yes (cross-lane; unavailable/failed/empty distinguished; source filter) | no | no |
|
||||
| Installed-package inventory (`sys list`, all lanes, `--legacy`) | yes | yes (VDB/Flatpak/Snap/AppImage; **Nix active-profile packages** vs generations/store; custom ebuild never double-counted) | yes (VM read-only group) | no |
|
||||
| Package information (`sys info`, `--legacy`) | yes | yes (installed/available, version/deps/size/provenance; ambiguity flagged) | yes (VM read-only group) | no |
|
||||
| Cross-source update check/apply (`sys updates`, `apply updates`) | yes | yes (exact per-source transactions with full Flatpak commits/snap revisions, pinned and revalidated; manual/project-specific refused) | Flatpak verified in VM (reviewed ref+commit, pinned update, verified); Snap unit-tested only; Portage verified | no |
|
||||
| Cross-source update check/apply (`sys updates`, `apply updates`) | yes | yes (exact per-source transactions with full Flatpak commits/snap revisions, pinned and revalidated; manual/project-specific refused) | Flatpak verified in VM (reviewed ref+commit, pinned update, verified); direct Snap refresh with no newer revision VM-verified, exact Snap apply-updates transaction unit-tested only; Portage verified | no |
|
||||
| Nix active-profile inventory (`sys list --nix`) | yes | yes (manifest v1/v2/v3; scope; generations vs store) | yes (NIX_ENABLED=yes install: real `nodejs-slim` profile listed and filtered; a re-run correctly reported a dangling profile) | no |
|
||||
| Catalogue maintenance (`depclean`, `clean cache`, `owners`, `deps`/`rdeps`) | yes | yes (structured depclean effects; cache-cleanup dry-run review + failure propagation; VDB dependency metadata) | yes (VM: depclean + cache-cleanup journeys; deps read-only) | no |
|
||||
| AI-default catalogue routing (source flags constrain, never bypass) | yes | yes (investigation loop, full backend classification + optional-backend rewrite, fallback offers exact `--legacy` command) | yes (read-only routing cases) | no |
|
||||
|
|
|
|||
23
docs/SYS.md
23
docs/SYS.md
|
|
@ -203,8 +203,27 @@ installs anything and never fabricates a candidate.
|
|||
| `snap refresh [name]` | `snap_refresh` | mutate |
|
||||
| `snap connections thunderbird` | `snap_connections` | read |
|
||||
|
||||
Snap requires a ready `snapd` daemon. If it is absent, `snap_install` installs
|
||||
`app-containers/snapd` through Portage and enables `snapd.socket` first.
|
||||
Snap requires a ready `snapd` daemon. A Snap install does not silently install
|
||||
the Portage dependency; that dependency receives its own review and approval.
|
||||
The normal `sys install <app> --legacy --snap` workflow must confirm the app
|
||||
against the Snap Store before approval, so its first use requires a separate,
|
||||
reviewed setup step:
|
||||
|
||||
```sh
|
||||
sys install app-containers/snapd --legacy --portage
|
||||
sys enable snapd.socket --legacy
|
||||
sys start snapd.socket --legacy
|
||||
sys install <app> --legacy --snap
|
||||
```
|
||||
|
||||
Run these on the installed system, not on the live installer. The resolver
|
||||
prints the setup commands when the daemon is missing. AppArmor availability
|
||||
determines the confinement reported by `snap debug confinement`; a running
|
||||
daemon alone does not imply strict confinement.
|
||||
New installs include the scoped `sys-fs/squashfs-tools lzma lzo` USE settings
|
||||
required by Gentoo's snapd ebuild. An existing installation made before that
|
||||
setting was added may need the same line in
|
||||
`/etc/portage/package.use/phoebus-snap` before the Portage step.
|
||||
Confinement is detected (`strict`/`partial`/`none`); `--classic` is only used
|
||||
when the typed action sets `"classic": true` and is shown in the review. The
|
||||
plan notes that snapd also refreshes automatically.
|
||||
|
|
|
|||
|
|
@ -683,6 +683,34 @@ detached boot verification with the live ISO removed.
|
|||
- Clean guest poweroff executed and verified (`sync; systemctl poweroff`).
|
||||
- Results: 6/6 PASS (`qemu-spawned`, `detached-boot-login`, `boot-systemd-running`, `boot-sys-installed`, `screenshot-01-boot-desktop`, `screenshot-02-final-state`).
|
||||
|
||||
## 2026-09-25 — Snap first-use acceptance on an installed disposable VM
|
||||
|
||||
- Target: `snap-acceptance.qcow2`, a disposable overlay of the installed
|
||||
`fresh-install-1.qcow2` image in the VM disk directory. QEMU/OVMF booted the
|
||||
installed system; no physical disk was attached or modified.
|
||||
- The first attempt found a real Gentoo dependency requirement:
|
||||
`sys-fs/squashfs-tools[lzma,lzo]`. The guest test applied only those scoped
|
||||
USE flags. Fresh Phoebus installs now generate the same package-specific
|
||||
setting.
|
||||
- The next attempt exposed a Portage resolver bug: the candidate was the
|
||||
first dependency (`dev-lang/go-bootstrap`) instead of the requested
|
||||
`app-containers/snapd`. The resolver now selects the requested atom, and the
|
||||
approved plan showed six new source packages including `snapd-2.63`.
|
||||
- Final run `serial-boot-20260926T001830Z-107996de` reported `PASS=10 FAIL=0`:
|
||||
installed snapd through the reviewed `sys` Portage path, enabled and started
|
||||
`snapd.socket`, installed Snap Store `hello-world` 6.4 revision 29 through
|
||||
`sys`, ran `sys snap refresh hello-world --legacy`, then removed it and
|
||||
verified absence. The daemon reported `partial` confinement and the install
|
||||
plan reported `partial` as well.
|
||||
- The refresh command succeeded with no newer revision. A revision-changing
|
||||
refresh and AppArmor-backed strict confinement remain unverified.
|
||||
- Final static `sys` SHA-256 `df608076aaf54290bfe0d4cdad9bcbca50064bf53ced62c44cf0e765d2a2f73f`
|
||||
was retested on the fresh `snap-acceptance-final.qcow2` overlay. The first
|
||||
run (`serial-boot-20260926T005327Z-c024cc43`) passed 11/11 checks including
|
||||
a clean guest poweroff. A clean reboot and repeat
|
||||
(`serial-boot-20260926T010605Z-e6193c3a`) also passed 11/11, with another
|
||||
`hello-world` install, refresh, removal and clean poweroff.
|
||||
|
||||
## Known remaining work
|
||||
|
||||
- The graphical session was verified with the **headless** wlroots backend
|
||||
|
|
|
|||
|
|
@ -340,6 +340,8 @@ pub fn package_use(config: &InstallConfig, hardware: &HardwareReport) -> String
|
|||
o.push_str("# its truetype/introspection edges form a circular dependency.\n");
|
||||
o.push_str("sys-fs/btrfs-progs -man\n");
|
||||
o.push_str("sys-fs/cryptsetup -man\n");
|
||||
o.push_str("# Allow the opt-in Snap lane without changing global USE flags.\n");
|
||||
o.push_str("sys-fs/squashfs-tools lzma lzo\n");
|
||||
o.push_str("dev-python/pillow -truetype\n");
|
||||
o.push_str("# Networking\n");
|
||||
o.push_str("net-misc/networkmanager systemd\n");
|
||||
|
|
@ -1531,6 +1533,7 @@ mod tests {
|
|||
// Required boot/encryption/session flags stay.
|
||||
assert!(text.contains("sys-apps/systemd boot policykit cryptsetup"));
|
||||
assert!(text.contains("sys-kernel/installkernel dracut systemd systemd-boot"));
|
||||
assert!(text.contains("sys-fs/squashfs-tools lzma lzo"));
|
||||
// BLS does not need the `uki` flag, and the empty wireplumber line and
|
||||
// the duplicate pipewire line are gone.
|
||||
assert!(!text.contains(" systemd-boot uki"));
|
||||
|
|
|
|||
|
|
@ -1301,11 +1301,6 @@ pub fn execute_inner(
|
|||
classic,
|
||||
} => {
|
||||
require_host_root(root, "install snap")?;
|
||||
// snapd is a Portage-managed system dependency; install it first if
|
||||
// the lane is requested but not yet present.
|
||||
if !snap::status(exec)?.usable() {
|
||||
snap::ensure_snapd(exec)?;
|
||||
}
|
||||
let out = snap::install(exec, name, channel.as_deref(), *classic)?;
|
||||
let confinement = snap::status(exec)
|
||||
.map(|s| s.confinement.as_str().to_string())
|
||||
|
|
@ -1607,6 +1602,20 @@ Total: 1 package (1 new), Size of downloads: 512 KiB
|
|||
assert!(matches!(err, ExecError::NotAuthorized(_)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn snap_install_does_not_add_an_unreviewed_portage_dependency() {
|
||||
let runner = RecordingRunner::new();
|
||||
let exec = make_exec(runner.clone());
|
||||
let action = SystemAction::SnapInstall {
|
||||
name: "hello-world".into(),
|
||||
channel: None,
|
||||
classic: false,
|
||||
};
|
||||
let err = execute(&exec, &action, Some(&auth()), Path::new("/")).unwrap_err();
|
||||
assert!(err.to_string().contains("snapd is not ready"), "{err}");
|
||||
assert!(emerge_calls(&runner.recorded()).is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn inspect_does_not_require_authorization() {
|
||||
let runner = RecordingRunner::new();
|
||||
|
|
|
|||
|
|
@ -217,6 +217,25 @@ pub fn parse_pretend_version(text: &str) -> Option<String> {
|
|||
None
|
||||
}
|
||||
|
||||
/// Pick the requested package from a Portage plan, not its first dependency.
|
||||
/// Portage prints dependencies before the target for larger installs.
|
||||
pub fn parse_pretend_target_version(text: &str, requested: &str) -> Option<String> {
|
||||
text.lines()
|
||||
.filter_map(|line| {
|
||||
let trimmed = line.trim_start();
|
||||
let rest = trimmed.strip_prefix('[')?.split_once(']')?.1.trim();
|
||||
let versioned = rest.split_whitespace().next()?;
|
||||
let (atom, _) = split_atom_version(versioned);
|
||||
let matches = if requested.contains('/') {
|
||||
atom == requested
|
||||
} else {
|
||||
atom.rsplit_once('/').map(|(_, name)| name) == Some(requested)
|
||||
};
|
||||
matches.then(|| versioned.to_string())
|
||||
})
|
||||
.next_back()
|
||||
}
|
||||
|
||||
/// Split an `emerge`-reported `category/package-version` token into the plain
|
||||
/// atom and the version. `emerge` rejects a bare versioned atom
|
||||
/// (`app-misc/hello-2.12.3` is not a valid atom), so the plain atom is the
|
||||
|
|
@ -302,7 +321,7 @@ pub fn resolve_candidates(exec: &Exec, root: &Path, need: &Need) -> Vec<Candidat
|
|||
match pretend {
|
||||
Ok(resolved) if resolved.success => {
|
||||
let text = resolved.stdout_lossy();
|
||||
let (atom, version) = parse_pretend_version(&text)
|
||||
let (atom, version) = parse_pretend_target_version(&text, name)
|
||||
.map(|v| split_atom_version(&v))
|
||||
.unwrap_or_else(|| (name.clone(), None));
|
||||
out.push(portage_candidate(&atom, false, version.as_deref(), &facts));
|
||||
|
|
@ -406,9 +425,9 @@ pub fn resolve_candidates(exec: &Exec, root: &Path, need: &Need) -> Vec<Candidat
|
|||
}
|
||||
|
||||
// --- Snap ---------------------------------------------------------
|
||||
if snap_on_host(root) && matches!(crate::snap::status(exec), Ok(s) if s.usable()) {
|
||||
if let Some(confinement) = snap_confinement_if_ready(exec, root) {
|
||||
let mut c = Candidate::new(Backend::Snap, name, "Snap Store");
|
||||
c.sandbox = SandboxLevel::Strong;
|
||||
c.sandbox = snap_sandbox(confinement);
|
||||
c.update_reliability = UpdateReliability::Automatic;
|
||||
c.verified = true;
|
||||
c.shared_runtime_mib = Some(200);
|
||||
|
|
@ -786,7 +805,7 @@ pub fn resolve_for_backend(
|
|||
}
|
||||
}
|
||||
Backend::Snap => {
|
||||
if snap_on_host(root) && matches!(crate::snap::status(exec), Ok(s) if s.usable()) {
|
||||
if let Some(confinement) = snap_confinement_if_ready(exec, root) {
|
||||
if let Ok(out) = exec.runner.execute(
|
||||
&CommandSpec::new("sys", "resolve snap name", "snap").args([
|
||||
"find",
|
||||
|
|
@ -801,12 +820,12 @@ pub fn resolve_for_backend(
|
|||
found.iter().filter(|c| exact(&c.name)).cloned().collect();
|
||||
if !exact_matches.is_empty() {
|
||||
for hit in exact_matches {
|
||||
candidates.push(snap_candidate(hit.name, hit.version, false));
|
||||
candidates.push(snap_candidate(hit.name, hit.version, confinement));
|
||||
}
|
||||
} else if found.len() == 1 {
|
||||
let hit = &found[0];
|
||||
let mut c =
|
||||
snap_candidate(hit.name.clone(), hit.version.clone(), false);
|
||||
snap_candidate(hit.name.clone(), hit.version.clone(), confinement);
|
||||
c.notes
|
||||
.push(format!("matched the friendly name `{application}`"));
|
||||
candidates.push(c);
|
||||
|
|
@ -827,9 +846,10 @@ pub fn resolve_for_backend(
|
|||
&["--pretend", "--quiet", "--color=n", "--", application],
|
||||
)) {
|
||||
if out.success {
|
||||
let (atom, version) = parse_pretend_version(&out.stdout_lossy())
|
||||
.map(|v| split_atom_version(&v))
|
||||
.unwrap_or_else(|| (application.to_string(), None));
|
||||
let (atom, version) =
|
||||
parse_pretend_target_version(&out.stdout_lossy(), application)
|
||||
.map(|v| split_atom_version(&v))
|
||||
.unwrap_or_else(|| (application.to_string(), None));
|
||||
if backend == Backend::PortageBinary {
|
||||
let bin_check = exec.runner.execute(&rooted(
|
||||
root,
|
||||
|
|
@ -927,15 +947,33 @@ pub fn resolve_for_backend(
|
|||
}
|
||||
}
|
||||
|
||||
fn snap_candidate(name: String, version: String, classic: bool) -> Candidate {
|
||||
fn snap_sandbox(confinement: crate::snap::Confinement) -> SandboxLevel {
|
||||
match confinement {
|
||||
crate::snap::Confinement::Strict => SandboxLevel::Strong,
|
||||
crate::snap::Confinement::Partial => SandboxLevel::Partial,
|
||||
crate::snap::Confinement::None => SandboxLevel::None,
|
||||
}
|
||||
}
|
||||
|
||||
fn snap_confinement_if_ready(exec: &Exec, root: &Path) -> Option<crate::snap::Confinement> {
|
||||
if !snap_on_host(root) {
|
||||
return None;
|
||||
}
|
||||
crate::snap::status(exec)
|
||||
.ok()
|
||||
.filter(crate::snap::SnapdStatus::usable)
|
||||
.map(|status| status.confinement)
|
||||
}
|
||||
|
||||
fn snap_candidate(
|
||||
name: String,
|
||||
version: String,
|
||||
confinement: crate::snap::Confinement,
|
||||
) -> Candidate {
|
||||
let mut c = Candidate::new(Backend::Snap, name, "Snap Store");
|
||||
c.version = Some(version);
|
||||
c.verified = true;
|
||||
c.sandbox = if classic {
|
||||
SandboxLevel::None
|
||||
} else {
|
||||
SandboxLevel::Strong
|
||||
};
|
||||
c.sandbox = snap_sandbox(confinement);
|
||||
c.update_reliability = UpdateReliability::Automatic;
|
||||
c
|
||||
}
|
||||
|
|
@ -1226,6 +1264,22 @@ mod tests {
|
|||
assert_eq!(parse_pretend_version("nothing here"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn portage_target_is_not_the_first_dependency() {
|
||||
let plan = "[ebuild N ] dev-lang/go-bootstrap-1.24.6\n\
|
||||
[ebuild N ] sys-fs/squashfs-tools-4.7.5\n\
|
||||
[ebuild N ] app-containers/snapd-2.63\n";
|
||||
assert_eq!(
|
||||
parse_pretend_target_version(plan, "app-containers/snapd").as_deref(),
|
||||
Some("app-containers/snapd-2.63")
|
||||
);
|
||||
assert_eq!(
|
||||
parse_pretend_target_version(plan, "snapd").as_deref(),
|
||||
Some("app-containers/snapd-2.63")
|
||||
);
|
||||
assert_eq!(parse_pretend_target_version(plan, "missing"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn split_atom_version_recovers_the_plain_install_atom() {
|
||||
// emerge rejects `cat/pkg-version`, so the install id must stay plain.
|
||||
|
|
@ -1255,7 +1309,7 @@ mod tests {
|
|||
// runner therefore answers the `chroot` wrapper.
|
||||
runner.set_response(
|
||||
"chroot",
|
||||
ok("Calculating dependencies... done!\n[ebuild N ] app-misc/hello-2.12.3 USE=\"nls\"\n"),
|
||||
ok("Calculating dependencies... done!\n[ebuild N ] dev-libs/example-1.0\n[ebuild N ] app-misc/hello-2.12.3 USE=\"nls\"\n"),
|
||||
);
|
||||
let exec = make_exec(runner.clone());
|
||||
let root = tempfile::tempdir().unwrap();
|
||||
|
|
@ -1278,6 +1332,24 @@ mod tests {
|
|||
assert_eq!(emerge.args[0], root.path().to_string_lossy());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn snap_candidate_uses_detected_confinement() {
|
||||
use crate::snap::Confinement;
|
||||
|
||||
assert_eq!(
|
||||
snap_candidate("notes".into(), "1".into(), Confinement::Strict).sandbox,
|
||||
SandboxLevel::Strong
|
||||
);
|
||||
assert_eq!(
|
||||
snap_candidate("notes".into(), "1".into(), Confinement::Partial).sandbox,
|
||||
SandboxLevel::Partial
|
||||
);
|
||||
assert_eq!(
|
||||
snap_candidate("notes".into(), "1".into(), Confinement::None).sandbox,
|
||||
SandboxLevel::None
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn system_preferences_roundtrip_through_disk() {
|
||||
let root = tempfile::tempdir().unwrap();
|
||||
|
|
|
|||
|
|
@ -513,6 +513,20 @@ pub fn resolve_explicit(
|
|||
.find(|c| c.available)
|
||||
.cloned()
|
||||
.ok_or_else(|| {
|
||||
if backend == Backend::Snap
|
||||
&& root == Path::new("/")
|
||||
&& matches!(crate::snap::status(exec), Ok(status) if !status.usable())
|
||||
{
|
||||
return ExecError::operation(
|
||||
"install",
|
||||
"resolve application",
|
||||
"the Snap lane is not ready, so the Snap Store cannot confirm a real candidate. \
|
||||
First review and install app-containers/snapd with \
|
||||
`sys install app-containers/snapd --legacy --portage`, then run \
|
||||
`sys enable snapd.socket --legacy` and \
|
||||
`sys start snapd.socket --legacy`; retry the Snap install",
|
||||
);
|
||||
}
|
||||
ExecError::operation(
|
||||
"install",
|
||||
"resolve application",
|
||||
|
|
@ -849,7 +863,7 @@ mod tests {
|
|||
let runner = RecordingRunner::new();
|
||||
runner.set_response(
|
||||
"emerge",
|
||||
ok("Calculating dependencies... done!\n[ebuild N ] app-editors/vim-9.1.0\n"),
|
||||
ok("Calculating dependencies... done!\n[ebuild N ] dev-libs/tre-0.9.0\n[ebuild N ] app-editors/vim-9.1.0\n"),
|
||||
);
|
||||
let exec = make_exec(runner);
|
||||
let root = tempfile::tempdir().unwrap();
|
||||
|
|
@ -861,7 +875,7 @@ mod tests {
|
|||
assert_eq!(resolved.source, InstallSource::ExplicitBackend);
|
||||
assert!(matches!(
|
||||
resolved.action,
|
||||
SystemAction::InstallPackage { .. }
|
||||
SystemAction::InstallPackage { ref atom, .. } if atom == "app-editors/vim"
|
||||
));
|
||||
let _ = root;
|
||||
}
|
||||
|
|
@ -880,6 +894,23 @@ mod tests {
|
|||
assert!(err.to_string().contains("snap"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn first_snap_install_explains_the_reviewed_bootstrap() {
|
||||
let runner = RecordingRunner::new();
|
||||
let exec = make_exec(runner.clone());
|
||||
let mut request = InstallRequest::new("thunderbird");
|
||||
request.backend = Some(Backend::Snap);
|
||||
let err = resolve_explicit(&exec, Path::new("/"), &request).unwrap_err();
|
||||
let message = err.to_string();
|
||||
assert!(message.contains("sys install app-containers/snapd --legacy --portage"));
|
||||
assert!(message.contains("sys start snapd.socket --legacy"));
|
||||
assert!(!runner.recorded().iter().any(|spec| {
|
||||
spec.args
|
||||
.iter()
|
||||
.any(|arg| arg == "--ask=n" || arg == "install")
|
||||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn validate_proposal_rejects_a_fabricated_candidate() {
|
||||
let runner = RecordingRunner::new();
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
//! Snap as an optional sandboxed application lane.
|
||||
//!
|
||||
//! Snap is not part of a default Phoebus install. When the user chooses it, the
|
||||
//! `app-containers/snapd` package is installed **through Portage** (systemd USE
|
||||
//! is mandatory and AppArmor is recommended — see the Gentoo wiki), the
|
||||
//! `snapd.socket` unit is enabled, and snaps are managed through the `snap`
|
||||
//! client.
|
||||
//! Snap is not part of a default Phoebus install. The user first reviews and
|
||||
//! installs `app-containers/snapd` through Portage, then enables and starts
|
||||
//! `snapd.socket`. Snaps are managed through the `snap` client.
|
||||
//!
|
||||
//! The lane is honest about its capabilities: the daemon must actually be ready,
|
||||
//! application confinement is detected rather than assumed, and the classic
|
||||
|
|
@ -82,13 +80,15 @@ pub struct SnapCandidate {
|
|||
|
||||
/// Parse `snap debug confinement` output (`strict`, `partial`, `none`).
|
||||
pub fn parse_confinement(text: &str) -> Confinement {
|
||||
let t = text.trim().to_ascii_lowercase();
|
||||
if t.contains("strict") {
|
||||
Confinement::Strict
|
||||
} else if t.contains("partial") {
|
||||
Confinement::Partial
|
||||
} else {
|
||||
Confinement::None
|
||||
match text
|
||||
.split_whitespace()
|
||||
.next()
|
||||
.map(|word| word.to_ascii_lowercase())
|
||||
.as_deref()
|
||||
{
|
||||
Some("strict") => Confinement::Strict,
|
||||
Some("partial") => Confinement::Partial,
|
||||
_ => Confinement::None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -133,29 +133,7 @@ pub fn status(exec: &Exec) -> Result<SnapdStatus> {
|
|||
})
|
||||
}
|
||||
|
||||
/// Install snapd through Portage and enable its socket on the running system.
|
||||
///
|
||||
/// This is the only supported way to introduce the lane: snapd must be a
|
||||
/// Portage-managed system component, never a `curl | sh` artifact.
|
||||
pub fn ensure_snapd(exec: &Exec) -> Result<()> {
|
||||
exec.logger
|
||||
.info(format!("installing {SNAPD_ATOM} through Portage (systemd)"));
|
||||
exec.run(
|
||||
CommandSpec::new("snap", "install snapd", "emerge")
|
||||
.args(["--ask=n", "--quiet-build=y", "--noreplace"])
|
||||
.arg(SNAPD_ATOM),
|
||||
)?;
|
||||
exec.run(
|
||||
CommandSpec::new("snap", "enable snapd socket", "systemctl").args([
|
||||
"enable",
|
||||
"--now",
|
||||
SNAPD_SOCKET,
|
||||
]),
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Whether a usable snapd is present; install it first when missing.
|
||||
/// Require a ready daemon; setup must have been reviewed separately.
|
||||
fn require_ready(exec: &Exec) -> Result<SnapdStatus> {
|
||||
let status = status(exec)?;
|
||||
if !status.usable() {
|
||||
|
|
@ -164,7 +142,9 @@ fn require_ready(exec: &Exec) -> Result<SnapdStatus> {
|
|||
"use snap",
|
||||
format!(
|
||||
"snapd is not ready (client present: {}, daemon active: {}); \
|
||||
install {SNAPD_ATOM} and enable {SNAPD_SOCKET} through Portage first",
|
||||
first run `sys install {SNAPD_ATOM} --legacy --portage`, \
|
||||
`sys enable {SNAPD_SOCKET} --legacy`, and \
|
||||
`sys start {SNAPD_SOCKET} --legacy`",
|
||||
status.client_present, status.daemon_ready
|
||||
),
|
||||
));
|
||||
|
|
@ -289,7 +269,8 @@ pub fn parse_list(text: &str) -> Vec<SnapEntry> {
|
|||
pub fn parse_info_summary(text: &str) -> (Option<String>, Option<String>, Confinement) {
|
||||
let mut version = None;
|
||||
let mut channel = None;
|
||||
let mut confinement = Confinement::Strict;
|
||||
// A missing field is unknown, never evidence of enforced confinement.
|
||||
let mut confinement = Confinement::None;
|
||||
for line in text.lines() {
|
||||
let trimmed = line.trim();
|
||||
if let Some(rest) = trimmed.strip_prefix("latest/stable:") {
|
||||
|
|
@ -360,10 +341,20 @@ mod tests {
|
|||
assert_eq!(parse_confinement("partial\n"), Confinement::Partial);
|
||||
assert_eq!(parse_confinement("none\n"), Confinement::None);
|
||||
assert_eq!(parse_confinement(""), Confinement::None);
|
||||
assert_eq!(
|
||||
parse_confinement("partial\nstrict confinement requires AppArmor"),
|
||||
Confinement::Partial
|
||||
);
|
||||
assert!(Confinement::Strict.enforced());
|
||||
assert!(!Confinement::None.enforced());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn snap_info_without_confinement_is_not_assumed_strict() {
|
||||
let (_, _, confinement) = parse_info_summary("name: notes\nlatest/stable: 1.0\n");
|
||||
assert_eq!(confinement, Confinement::None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn status_requires_both_client_and_daemon() {
|
||||
let runner = RecordingRunner::new();
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ touching a physical disk. The target is always a qcow2 file.
|
|||
`rollback` modes).
|
||||
- `rollback-guest.sh`, `rollback-verify.sh` guest-side rollback acceptance
|
||||
(fetch `sys`, snapshot, break, undo, verify).
|
||||
- `snap-guest.sh` guest-side Snap setup/install/refresh/remove acceptance.
|
||||
- `test.conf.example` installer configuration used by the driver.
|
||||
|
||||
## Host prerequisites
|
||||
|
|
@ -92,6 +93,24 @@ Point `DISK` at a **disposable clone** of the evidence image so the original is
|
|||
preserved. Booting the recovery entry itself with the network removed remains a
|
||||
manual gate; the harness records the entry but does not select it.
|
||||
|
||||
## Snap acceptance on an installed disposable image
|
||||
|
||||
Serve the current static `sys` binary and `snap-guest.sh` from a small local
|
||||
directory. Boot an installed **qcow2 overlay** with `serial-driver.py boot`,
|
||||
setting `BOOT_AUTHENTICATE=1`, `BOOT_POWEROFF=1`, `CHECKS_TIMEOUT=7200`,
|
||||
and the following checks. `BOOT_POWEROFF` cleanly shuts down the guest after
|
||||
mutating checks so a later boot observes committed state:
|
||||
|
||||
```sh
|
||||
BOOT_REQUIRE_CASES=snap-sys,snap-portage,snap-socket,snap-confinement,snap-install,snap-refresh,snap-remove
|
||||
BOOT_CHECKS='echo ===CHECKS-$(printf START)===; echo SYSTEMD_STATUS:$(systemctl is-system-running); curl -fsSL http://10.0.2.2:8000/snap-guest.sh -o /tmp/snap-guest.sh; sudo bash /tmp/snap-guest.sh; echo ===CHECKS-$(printf END)==='
|
||||
```
|
||||
|
||||
The guest script adds only the scoped `sys-fs/squashfs-tools lzma lzo` USE
|
||||
setting to the disposable image, then uses `sys` for the reviewed Portage
|
||||
install, socket activation and Snap actions. The boot driver logs only guest
|
||||
output, not the test passwords it sends for LUKS, login and `sudo`.
|
||||
|
||||
## Safety (enforced, not just documented)
|
||||
|
||||
`vmsafety.py` validates every writable drive before QEMU starts:
|
||||
|
|
|
|||
|
|
@ -88,7 +88,9 @@ def spawn(args, env, log):
|
|||
encoding="utf-8", codec_errors="replace",
|
||||
maxread=65536)
|
||||
child.delaybeforesend = 0.3
|
||||
child.logfile = log
|
||||
# Log only guest output. The general logfile also records bytes sent by
|
||||
# pexpect, including LUKS, login and sudo passwords.
|
||||
child.logfile_read = log
|
||||
return child
|
||||
|
||||
|
||||
|
|
@ -305,22 +307,35 @@ def do_boot(results, paths, disks):
|
|||
log = open(paths.serial_log, "w")
|
||||
child = spawn(args, env, log)
|
||||
try:
|
||||
child.expect([r"[Pp]assphrase", r"login:"], timeout=300)
|
||||
if "assphrase" in (child.after or ""):
|
||||
first_prompt = child.expect([r"[Pp]assphrase", r"login:"], timeout=300)
|
||||
login_ready = first_prompt == 1
|
||||
if first_prompt == 0:
|
||||
child.sendline(LUKS_PW)
|
||||
logged_in = False
|
||||
for _ in range(5):
|
||||
child.expect(r"phoebus login:", timeout=180)
|
||||
if not login_ready:
|
||||
child.expect(r"phoebus login:", timeout=180)
|
||||
login_ready = False
|
||||
child.sendline(USER)
|
||||
idx = child.expect([r"[Pp]assword:", r"phoebus login:",
|
||||
r"Login incorrect"], timeout=30)
|
||||
if idx == 0:
|
||||
child.sendline(USER_PW)
|
||||
if child.expect([r"[$#] $", r"Login incorrect",
|
||||
r"phoebus login:"], timeout=60) == 0:
|
||||
login_result = child.expect([r"[$#] $", r"Login incorrect",
|
||||
r"phoebus login:"], timeout=60)
|
||||
if login_result == 0:
|
||||
logged_in = True
|
||||
break
|
||||
login_ready = login_result == 2
|
||||
else:
|
||||
login_ready = idx == 1
|
||||
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)
|
||||
if idx == 0:
|
||||
child.sendline(USER_PW)
|
||||
child.expect(r"[$#] $", 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")
|
||||
|
|
@ -334,6 +349,21 @@ def do_boot(results, paths, disks):
|
|||
status in ("running", "degraded"),
|
||||
f"systemd did not report running/degraded (observed: {status})",
|
||||
)
|
||||
for case in os.environ.get("BOOT_REQUIRE_CASES", "").split(","):
|
||||
case = case.strip()
|
||||
if case:
|
||||
results.assert_true(
|
||||
f"boot-case-{case}",
|
||||
f"CASE {case} PASS" in checks_text,
|
||||
f"{case} did not report PASS",
|
||||
)
|
||||
if os.environ.get("BOOT_POWEROFF") == "1":
|
||||
child.sendline("sudo systemctl poweroff")
|
||||
idx = child.expect([r"[Pp]assword(?: for [^:]+)?:", pexpect.EOF], timeout=60)
|
||||
if idx == 0:
|
||||
child.sendline(USER_PW)
|
||||
child.expect(pexpect.EOF, timeout=120)
|
||||
results.pass_("boot-clean-poweroff")
|
||||
except pexpect.TIMEOUT as exc:
|
||||
results.fail("boot", f"timeout: {exc}")
|
||||
except pexpect.EOF:
|
||||
|
|
|
|||
74
installer/tests/vm/snap-guest.sh
Normal file
74
installer/tests/vm/snap-guest.sh
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
#!/bin/bash
|
||||
# Snap lane acceptance on an installed, disposable Phoebus qcow2 only.
|
||||
# Run as root through serial-driver.py BOOT_AUTHENTICATE=1.
|
||||
set -uo pipefail
|
||||
|
||||
SYS=/tmp/phoebus-snap-sys
|
||||
SYS_URL="${SYS_URL:-http://10.0.2.2:8000/sys}"
|
||||
|
||||
case "$(findmnt -n -o SOURCE /)" in
|
||||
/dev/mapper/*) ;;
|
||||
*) echo 'CASE snap-target FAIL root is not the installed encrypted VM'; exit 1 ;;
|
||||
esac
|
||||
|
||||
if curl -fsSL "$SYS_URL" -o "$SYS" && chmod 755 "$SYS" && "$SYS" --version; then
|
||||
echo 'CASE snap-sys PASS current static sys is available'
|
||||
else
|
||||
echo 'CASE snap-sys FAIL could not fetch current static sys'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Gentoo's snapd ebuild requires these two scoped squashfs-tools flags. The
|
||||
# minimal VM profile omits them, so record the prerequisite explicitly.
|
||||
install -d -m 0755 /etc/portage/package.use
|
||||
printf '%s\n' 'sys-fs/squashfs-tools lzma lzo' \
|
||||
> /etc/portage/package.use/phoebus-snap
|
||||
|
||||
if compgen -G '/var/db/pkg/app-containers/snapd-*' >/dev/null; then
|
||||
echo 'CASE snap-portage PASS snapd already installed through Portage'
|
||||
elif "$SYS" -y install app-containers/snapd --legacy --portage; then
|
||||
echo 'CASE snap-portage PASS reviewed snapd install'
|
||||
else
|
||||
echo 'CASE snap-portage FAIL reviewed snapd install failed'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if "$SYS" -y enable snapd.socket --legacy && "$SYS" -y start snapd.socket --legacy \
|
||||
&& systemctl is-active --quiet snapd.socket; then
|
||||
echo 'CASE snap-socket PASS enabled and active'
|
||||
else
|
||||
echo 'CASE snap-socket FAIL socket did not become active'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if snap debug confinement; then
|
||||
echo 'CASE snap-confinement PASS daemon reported confinement'
|
||||
else
|
||||
echo 'CASE snap-confinement FAIL could not determine confinement'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if snap list hello-world >/dev/null 2>&1; then
|
||||
echo 'CASE snap-install PASS snap already installed by sys'
|
||||
elif "$SYS" -y install hello-world --legacy --snap && snap list hello-world; then
|
||||
echo 'CASE snap-install PASS installed via reviewed sys plan'
|
||||
else
|
||||
echo 'CASE snap-install FAIL install or inventory failed'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if "$SYS" -y snap refresh hello-world --legacy; then
|
||||
echo 'CASE snap-refresh PASS refresh path completed'
|
||||
else
|
||||
echo 'CASE snap-refresh FAIL refresh path failed'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if "$SYS" -y snap remove hello-world --legacy && ! snap list hello-world >/dev/null 2>&1; then
|
||||
echo 'CASE snap-remove PASS snap removed'
|
||||
else
|
||||
echo 'CASE snap-remove FAIL removal or absence check failed'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo '===SNAP-ACCEPTANCE-DONE==='
|
||||
Loading…
Add table
Reference in a new issue