Skip to main content

windows_headless/
paths.rs

1//! Single source of truth for every well-known file and cache-group name:
2//! installer artifacts, per-VM state files, portable-tree layout, cache
3//! groups. Renaming means editing here — a literal for one of these names
4//! anywhere else silently splits old/new state (a renamed file the code
5//! can't find, a cache group that orphans gigabytes).
6//!
7//! Deliberately NOT here: socket names (already in [`crate::ipc`]),
8//! version pins ([`crate::pins`]), guest-arch mappings like firmware and
9//! OpenSSH zip names (data belonging with the arch table in
10//! [`crate::unattend`]), and `include_str!` source paths (must stay
11//! literal). Tests keep literals on purpose: they guard these values.
12//! Help text in `main.rs` repeats names for humans; those are docs.
13
14// --- installer inputs ---------------------------------------------------
15/// VirtIO driver ISO (vendored release asset, ISO cache, USB staging).
16pub const VIRTIO_ISO: &str = "virtio-win.iso";
17/// Hash sidecar next to the virtio release asset.
18pub const VIRTIO_ISO_SHA256: &str = "virtio-win.iso.sha256";
19/// Eval ISO filename used by the `fetch` chain.
20pub const EVAL_ISO_NAME: &str = "Win11_Enterprise_Eval.iso";
21/// Answer file at the installer USB root and in `gen` output dirs.
22pub const UNATTEND_XML: &str = "autounattend.xml";
23/// Partition script inside the installer USB tree.
24pub const PART_TXT_PATH: &str = "setup/part.txt";
25/// Driver/tools dir inside the installer USB tree.
26pub const TOOLS_DIR: &str = "tools";
27/// Stage subdir for an explicit `--drivers-dir` tree.
28pub const DRIVERS_STAGE_DIR: &str = "drivers";
29
30// --- per-VM state (inside the VM dir) ------------------------------------
31/// Boot disk `run` boots and `install` writes.
32pub const DISK_IMAGE: &str = "disk.qcow2";
33/// Guest NVRAM copy, seeded from the portable firmware template.
34pub const VARS_FILE: &str = "VARS.fd";
35/// QEMU pidfile: written on launch, removed by `stop`.
36pub const QEMU_PIDFILE: &str = "qemu.pid";
37/// Installer QEMU's stdout/stderr capture.
38pub const INSTALL_LOG: &str = "install.log";
39/// Live-snapshot companions (all inside the VM dir, all removed when an
40/// install voids them): migrated RAM + device state, the VARS backup taken
41/// at the same instant (raw pflash is outside every snapshot), and the
42/// overlay that has held post-save writes since the pivot.
43pub const LIVE_STATE_FILE: &str = "golden-live.state";
44pub const LIVE_VARS_BACKUP: &str = "VARS.fd.golden-live";
45pub const LIVE_OVERLAY: &str = "disk-live-overlay.qcow2";
46
47// --- cache layout (group names under the cache root) ---------------------
48pub const QEMU_GROUP: &str = "qemu-portable";
49pub const WIMLIB_GROUP: &str = "wimlib-portable";
50pub const ISO_GROUP: &str = "iso";
51pub const VM_GROUP: &str = "vms/win11";
52pub const MEDIA_GROUP: &str = "media";
53/// USB installer image inside the media group.
54pub const WINUSB_IMAGE: &str = "winusb.dmg";
55
56// --- no-downloader fallbacks (local relative paths) ----------------------
57pub const FALLBACK_VM_DIR: &str = "./win11-vm";
58pub const FALLBACK_WINUSB_IMAGE: &str = "./winusb.dmg";
59pub const FALLBACK_UNATTEND_DIR: &str = "./unattend_dir";
60pub const FALLBACK_QEMU_CACHE: &str = ".cache/qemu-portable";
61
62// --- portable-tree layout -------------------------------------------------
63/// Extracted tree dir name (`<group>/<tag>/qemu-portable`), for QEMU…
64pub const QEMU_INNER: &str = "qemu-portable";
65/// …and wimlib.
66pub const WIMLIB_INNER: &str = "wimlib-portable";
67/// Binary dir inside an extracted tree.
68pub const PORTABLE_BIN_DIR: &str = "bin";
69/// `qemu-img` binary name (sentinel proving a QEMU tree is extracted).
70pub const QEMU_IMG_NAME: &str = "qemu-img";
71/// `wimlib-imagex` binary name (sentinel proving a wimlib tree is extracted).
72pub const WIMLIB_IMGX_NAME: &str = "wimlib-imagex";
73
74// --- release asset conventions --------------------------------------------
75/// Asset name prefix selecting this host's QEMU archive in a release.
76pub const QEMU_ASSET_PREFIX: &str = "qemu-portable-";
77/// Asset name prefix selecting this host's wimlib archive in a release.
78pub const WIMLIB_ASSET_PREFIX: &str = "wimlib-portable-";
79/// Host-asset markers selecting the per-platform archive (and its pinned
80/// hash in [`crate::pins`]). Single source of truth: `asset_for_host` and
81/// the pin lookups both match on these — never retype the literals.
82pub const MARKER_MACOS_ARM64: &str = "macos-arm64";
83pub const MARKER_LINUX_X86_64: &str = "linux-x86_64";
84pub const MARKER_LINUX_AARCH64: &str = "linux-aarch64";
85/// Checksum sheet published next to release assets.
86pub const SHA256SUMS_FILE: &str = "SHA256SUMS.txt";