Documentation
¶
Overview ¶
Package wsldistro manages the dedicated jerboa WSL2 distribution: a versioned, self-contained Linux environment (jerboad + qemu + firecracker + kernel toolchain) imported via `wsl --import`, the way Docker Desktop ships its own distro. Running the daemon inside it removes any dependency on the user's WSL setup, on jerboad being on PATH, or on host sudo.
Index ¶
- Constants
- func DefaultInstallDir() string
- func EnsureNestedVirtualization() (changed bool, path string, err error)
- func Exists() (bool, error)
- func IP() (string, error)
- func Import(installDir, rootfsTar string) error
- func InstallDaemonBinary(localPath string) error
- func List() ([]string, error)
- func Unregister() error
- func WSLConfigPath() (string, error)
Constants ¶
const DaemonBinaryPath = "/usr/local/bin/jerboad"
DaemonBinaryPath is where jerboad lives inside the distro (baked there by the rootfs image and replaced in place on upgrade).
const Name = "jerboa"
Name is the registered WSL2 distribution name.
const RootfsArtifact = "jerboa-rootfs-amd64.tar.gz"
RootfsArtifact is the release asset holding the distro root filesystem.
Variables ¶
This section is empty.
Functions ¶
func DefaultInstallDir ¶
func DefaultInstallDir() string
DefaultInstallDir returns where the distro's ext4 disk is stored on Windows (%LOCALAPPDATA%\jerboa\distro), falling back to ~/.jerboa/distro.
func EnsureNestedVirtualization ¶
EnsureNestedVirtualization makes sure %USERPROFILE%\.wslconfig enables nested virtualization under the [wsl2] section, which firecracker needs for /dev/kvm. It edits the file in place, preserving any other settings, and returns whether it changed anything. A change only takes effect after `wsl --shutdown`, so the caller should tell the user to restart WSL when changed is true.
func IP ¶
IP returns the IPv4 address of the running distro's primary interface. WSL2 loopback forwarding does not reach a secondary distro, so the Windows client dials this address directly. Querying it starts the distro if it is stopped.
func InstallDaemonBinary ¶
InstallDaemonBinary streams the file at localPath into the distro, replacing the jerboad binary atomically (write-then-rename, so a crash never leaves a truncated binary). Piping over stdin avoids translating the Windows path into the distro's /mnt view. The caller should stop the daemon first to avoid ETXTBSY on the running binary.
func WSLConfigPath ¶
WSLConfigPath returns the path to the host's per-user .wslconfig (%USERPROFILE%\.wslconfig).
Types ¶
This section is empty.