1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! Podman machine **init** — the macOS VM / Windows WSL2 distro.
//!
//! This module owns creating the global machine ([`machine_init`]); making it
//! *running* is [`super::running`]'s job. The machine is **global**, named
//! [`MACHINE_NAME`] (`objectiveai`), shared by every objectiveai dir on the
//! host — matching Linux's already-global container state. Linux runs
//! containers natively, so it has no machine and never calls in here.
//!
//! [`machine_init`] is a raw, lock-free primitive: the reconcile in
//! [`super::running`] only calls it once it has probed the machine `Absent`,
//! holding the `podman-machine` bin lock. A genuine cross-dir `init` race
//! (another objectiveai dir creating the machine between the probe and the
//! init) is absorbed by treating podman's "already exists" as success — podman
//! itself serializes machine creation.
use Path;
use crateError;
/// The single global podman machine name, shared by every objectiveai dir on
/// the host. Public so the "use podman" code targets it
/// (`podman --connection objectiveai ...`).
pub const MACHINE_NAME: &str = "objectiveai";
/// Create the global podman machine (`podman machine init objectiveai`).
///
/// Raw primitive — no existence pre-check, no lock: the caller
/// ([`super::running::ensure_running`]) has already probed the machine `Absent`
/// under the `podman-machine` lock. `machine init` downloads a large VM/WSL
/// image, so no short timeout is imposed; the caller's lock serializes in-dir
/// callers. `exe` is the podman binary from [`super::install`]; `helper_dir`
/// (podman's own dir) is wired in so it finds the bundled machine helpers.
pub async
/// A `podman` command with the bundled helper dir wired in
/// (`CONTAINERS_HELPER_BINARY_DIR`) so podman finds the machine helpers that
/// ship beside it (`gvproxy`/`win-sshproxy` on Windows, `vfkit`/`gvproxy` on
/// macOS).
pub