# `Hyper.Node.FireVMM.VmLinux.Provider`
[🔗](https://github.com/harmont-dev/hyper/blob/main/lib/hyper/node/fire_vmm/vm_linux/provider.ex#L1)

Installs the guest-kernel (vmlinux) images for the current architecture into
`Hyper.Cfg.Dirs.vmlinux_install_dir/0` (`<work_dir>/redist/vmlinux`).

The available kernels and their SHA-256 sums come from the statically-embedded
`Hyper.Node.FireVMM.VmLinux.Manifest`. `ensure_installed/0` installs *every*
build for this node's architecture and is idempotent: if all the expected
images are already present it returns `:ok` without touching the network.
Otherwise it fetches each missing image via `Redist.File` (download,
SHA-256 verify, install).

This is the download-side counterpart to operator-provided kernels; see
`Hyper.Node.Vmlinux`, which prefers an operator-configured path and falls back
to `default_path/1` here.

# `default_path`

```elixir
@spec default_path(Sys.Arch.t()) ::
  {:ok, Path.t()} | {:error, {:no_kernel, Sys.Arch.t()}}
```

Absolute path to the default (highest-version) kernel for `arch`. The returned path is only guaranteed to exist for the node's current architecture (the one `ensure_installed/0` installs).

# `ensure_installed`

```elixir
@spec ensure_installed() :: :ok | {:error, term()}
```

Ensure every kernel for this node's architecture is installed.

# `install_state`

```elixir
@spec install_state(Path.t(), [Hyper.Node.FireVMM.VmLinux.Manifest.Build.t()]) ::
  :ok | {:error, :not_installed | :bad_install}
```

Install state of `builds` under `dir`: `:ok` if every asset file is present
with the manifest's SHA-256; `{:error, :not_installed}` if none are;
`{:error, :bad_install}` if only some are (a partial/corrupt install -
`Redist.File` keeps existing files, so the remedy is to wipe and reinstall).

Presence alone is not enough: after a manifest bump the old release's kernels
sit at the same asset paths, and skipping the hash check would keep booting
guests on the previous release forever.

# `path`

```elixir
@spec path(String.t()) :: {:ok, Path.t()} | {:error, {:unknown_build, String.t()}}
```

Absolute path to the installed kernel for build `name` (e.g. "x86_64-6.1"). The returned path is only guaranteed to exist for the node's current architecture (the one `ensure_installed/0` installs).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
