media

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package media is winkit's install-media fetch policy: which source serves the Windows installer ISO, in what order, and with what fallback. It sits above the per-source packages (mctcatalog, uupdump, virtio), which each know how to fetch from one place but not which place to try first.

The winkit CLI calls these same functions, so a library consumer gets the exact media the CLI would use for the same options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchVirtioISO

func FetchVirtioISO(ctx context.Context, opts FetchOptions) (string, error)

FetchVirtioISO returns the cached virtio-win driver ISO, downloading it when missing or unusable. It delegates to virtio.FetchISO; only CacheDir, OnProgress and the logging fields of opts apply. Call virtio.FetchISO directly to override the download URL or HTTP client.

Types

type FetchOptions

type FetchOptions struct {
	// CacheDir holds the assembled ISOs and the intermediate downloads.
	// Empty means cache.Dir().
	CacheDir string

	// Spec selects the Windows media. A build pin (Spec.Build, or a build
	// number in Spec.Version) routes straight to UUP dump. Ignored by
	// FetchVirtioISO.
	Spec Spec

	// Concurrency is the number of parallel UUP dump downloads. Zero
	// means the uupdump default.
	Concurrency int

	// OnProgress reports per-file download progress from whichever
	// source runs. total is 0 when the size is unknown. FetchVirtioISO
	// reports under cache.VirtIOISOName.
	OnProgress func(filename string, downloaded, total int64)

	// OnFileStart / OnFileDone bracket each UUP dump ESD download. The
	// MCT catalog fetches a single ESD and does not call them.
	OnFileStart func(filename string)
	OnFileDone  func(filename string, size int64)

	// Logger receives leveled progress output, including the lane
	// decisions made here. LogFunc is the level-less alternative, used
	// only when Logger is nil.
	Logger  *slog.Logger
	LogFunc func(format string, args ...any)
}

FetchOptions configures FetchWindowsISO and FetchVirtioISO. Every field is optional.

type FetchResult

type FetchResult struct {
	// Path is the cached, EFI-bootable ISO.
	Path string
	// Source is the pipeline that produced Path.
	Source Source
	// BootOnly reports that the ISO carries boot.wim and setup media but
	// no install.wim. That suffices for WinPE builds; a full install
	// needs complete media.
	BootOnly bool
	// FallbackErr is the MCT catalog failure that forced the UUP dump
	// fallback. It is nil when MCT served the ISO or a build pin skipped
	// the catalog.
	FallbackErr error
}

FetchResult describes the Windows ISO FetchWindowsISO produced.

func FetchWindowsISO

func FetchWindowsISO(ctx context.Context, opts FetchOptions) (FetchResult, error)

FetchWindowsISO returns a cached Windows installer ISO for opts.Spec, downloading and assembling it when missing.

Lane routing: the default (no build pin) fetches from the MCT catalog, the only source that produces a complete, self-contained install image. A build pin routes to UUP dump in boot-only mode, since a pinned build's ESDs cannot produce a complete install.wim but boot.wim always exports clean. If the MCT catalog fails, the default lane falls back to UUP dump boot-only with a warning.

type Source

type Source string

Source identifies which pipeline produced a Windows ISO.

const (
	// SourceMCT is the Media Creation Tool catalog: complete,
	// self-contained install media for the current GA build.
	SourceMCT Source = "mct"
	// SourceUUPDump is UUP dump, used for pinned builds and as the
	// fallback when the MCT catalog is unavailable.
	SourceUUPDump Source = "uupdump"
)

type Spec

type Spec = uupdump.MediaSpec

Spec names Windows installation media along orthogonal axes (OS, product, arch, version, build, edition, language). Every field is optional; zero values resolve to Windows 11 24H2 arm64 en-us Professional. It is uupdump.MediaSpec, re-exported so callers of this package need not import the source packages.

Directories

Path Synopsis
Package virtio downloads the virtio-win driver ISO, the source of the storage, serial and network drivers WinPE needs to see a QEMU guest's devices.
Package virtio downloads the virtio-win driver ISO, the source of the storage, serial and network drivers WinPE needs to see a QEMU guest's devices.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL