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/// Windows 11 retail ISO filename used by the `fetch` chain.
20/// Proven media is retail (`Windows11_Client_*`); non-retail
21/// (Enterprise/OEM) media has never been exercised (see README "Not tested").
22pub const WIN11_ISO_NAME: &str = "Windows11_Client.iso";
23/// Answer file at the installer USB root and in `gen` output dirs.
24pub const UNATTEND_XML: &str = "autounattend.xml";
25/// Partition script inside the installer USB tree.
26pub const PART_TXT_PATH: &str = "setup/part.txt";
27/// Driver/tools dir inside the installer USB tree.
28pub const TOOLS_DIR: &str = "tools";
29/// Stage subdir for an explicit `--drivers-dir` tree.
30pub const DRIVERS_STAGE_DIR: &str = "drivers";
31
32// --- per-VM state (inside the VM dir) ------------------------------------
33/// Boot disk `run` boots and `install` writes.
34pub const DISK_IMAGE: &str = "disk.qcow2";
35/// Guest NVRAM copy, seeded from the portable firmware template.
36pub const VARS_FILE: &str = "VARS.fd";
37/// QEMU pidfile: written on launch, removed by `stop`.
38pub const QEMU_PIDFILE: &str = "qemu.pid";
39/// Installer QEMU's stdout/stderr capture.
40pub const INSTALL_LOG: &str = "install.log";
41/// Live-snapshot companions (all inside the VM dir, all removed when an
42/// install voids them): migrated RAM + device state, the VARS backup taken
43/// at the same instant (raw pflash is outside every snapshot), and the
44/// overlay that has held post-save writes since the pivot.
45pub const LIVE_STATE_FILE: &str = "golden-live.state";
46pub const LIVE_VARS_BACKUP: &str = "VARS.fd.golden-live";
47pub const LIVE_OVERLAY: &str = "disk-live-overlay.qcow2";
48
49// --- cache layout (group names under the cache root) ---------------------
50pub const QEMU_GROUP: &str = "qemu-portable";
51pub const WIMLIB_GROUP: &str = "wimlib-portable";
52pub const ISO_GROUP: &str = "iso";
53pub const VM_GROUP: &str = "vms/win11";
54pub const MEDIA_GROUP: &str = "media";
55/// USB installer image inside the media group.
56pub const WINUSB_IMAGE: &str = "winusb.dmg";
57
58// --- no-downloader fallbacks (local relative paths) ----------------------
59pub const FALLBACK_VM_DIR: &str = "./win11-vm";
60pub const FALLBACK_WINUSB_IMAGE: &str = "./winusb.dmg";
61pub const FALLBACK_UNATTEND_DIR: &str = "./unattend_dir";
62pub const FALLBACK_QEMU_CACHE: &str = ".cache/qemu-portable";
63
64// --- portable-tree layout -------------------------------------------------
65/// Extracted tree dir name (`<group>/<tag>/qemu-portable`), for QEMU…
66pub const QEMU_INNER: &str = "qemu-portable";
67/// …and wimlib.
68pub const WIMLIB_INNER: &str = "wimlib-portable";
69/// Binary dir inside an extracted tree.
70pub const PORTABLE_BIN_DIR: &str = "bin";
71/// `qemu-img` binary name (sentinel proving a QEMU tree is extracted).
72pub const QEMU_IMG_NAME: &str = "qemu-img";
73/// `wimlib-imagex` binary name (sentinel proving a wimlib tree is extracted).
74pub const WIMLIB_IMGX_NAME: &str = "wimlib-imagex";
75
76// --- release asset conventions --------------------------------------------
77/// Asset name prefix selecting this host's QEMU archive in a release.
78pub const QEMU_ASSET_PREFIX: &str = "qemu-portable-";
79/// Asset name prefix selecting this host's wimlib archive in a release.
80pub const WIMLIB_ASSET_PREFIX: &str = "wimlib-portable-";
81/// Host-asset markers selecting the per-platform archive (and its pinned
82/// hash in [`crate::pins`]). Single source of truth: `asset_for_host` and
83/// the pin lookups both match on these — never retype the literals.
84pub const MARKER_MACOS_ARM64: &str = "macos-arm64";
85pub const MARKER_LINUX_X86_64: &str = "linux-x86_64";
86pub const MARKER_LINUX_AARCH64: &str = "linux-aarch64";
87/// Checksum sheet published next to release assets.
88pub const SHA256SUMS_FILE: &str = "SHA256SUMS.txt";