Expand description
A guided setup of this computer: what to install, start or restart, in which order, for the kinds of project wanted (containers, VMs), with which engine and which hypervisor. The one place these rules live:
optionsworks out, from what the machine check found (Machine), what each choice a setup offers takes here: a UI renders those actions and runs each, never working them out itself;plan()puts them in order for a whole setup, from what isWanted;walk()runs that plan step by step through the caller’s own runner of each step, the machine checked again after each (an install changes what comes next);- on Windows,
join_hyperv_adminsandschedule_restartcarry out what a setup asks beyond installs, ascrate::docker::start_enginestarts an engine; on Linux,share_virtualizationlets VirtualBox share the CPU’s virtualization with KVM.
Why something is passed over or left alone is a code (PassedOver, LeftAlone) a UI says
in its own words.
Structs§
- Docker
Found - Docker and its engines, as the machine check found them.
- Engine
Option - A container engine, and what makes it the one Docker uses here.
- Hypervisor
Option - A local hypervisor: what gets it here (
get: nothing once it is installed and can run), then what Vagrant needs to drive it (vagrant: Vagrant, its plugin, VMware’s utility, in order). - Machine
- What a setup reads of the machine check (
Check): the computer, its package manager, Docker and its engines, WSL 2, the Vagrant providers and the groups pending a login. - Options
- What each choice of a setup takes on this computer.
- Plan
- A whole setup on one computer.
- Step
- One action of a plan, with the item it is about (
wsl,docker,engine:<id>,vagrant,<hypervisor>,plugin:<name>,vmware-utility). - Steps
- How a walk runs its steps: the caller’s own runner of each, and its machine check.
- Walked
- Where a walk ended.
- Wanted
- What a whole setup is for.
Enums§
- Action
- One thing a setup does, or leaves to its user, on this computer.
- Event
- What a walk tells as it goes;
O: how the caller’s runner says a step ended. - Left
Alone - Why a setup leaves a step alone: its user’s to take, or it can’t run here (
left_alone). - Manual
Reason - Why something is the user’s to get.
- OnFailure
- What a walk does once a step failed.
- Passed
Over - Why a hypervisor wanted isn’t the one a setup sets up. A UI says each in its own words.
- Restart
- How a restart was asked for.
- Restart
Failed - Why a restart wasn’t scheduled.
- Setup
Path - A kind of project a setup readies this computer for.
- Share
Failed - Why KVM wasn’t set to share the CPU’s virtualization.
- Shared
- When VirtualBox can use the CPU’s virtualization.
- Windows
Feature - A Windows feature that starts only after a restart.
Constants§
- OPTION
- The option itself: KVM turns the CPU’s virtualization on only while one of its VMs runs.
- OPTION_
FILE - The modprobe file the option is written to, in
/etc/modprobe.d. - RESTART_
NOTE_ MAX - The longest note a restart shows while Windows counts down (
shutdown.exetakes 512).
Functions§
- cant_
run - An installed hypervisor that still can’t run VMs once everything Vagrant needs is in (no
/dev/kvm, not in the kvm group, a stuck service): itsreasonsays why. - engines_
on - The engines a setup offers on
os, in the order it shows them. - installable
- The hypervisor a setup installs as
provideronos, when it installs it. - join_
hyperv_ admins - Adds this account to “Hyper-V Administrators” (
join_hyperv_admins_step), each line it prints handed toon_line. - join_
hyperv_ admins_ step - The step that adds this account to “Hyper-V Administrators” through one UAC prompt: the membership applies from the account’s next sign-in.
- left_
alone - Why a setup doesn’t run
actionitself, when it doesn’t: its user’s to take, or it can’t run here. None for a step a setup runs (a restart and a new login it leaves to its caller). - options
- What each choice takes on machine
m;hyperv_restart: a setup turned Hyper-V on in this boot, so it waits for a restart. - plan
- The whole setup
wantedon machinemwith itsoptions(super::options), in a setup’s order: WSL 2 and the engine, then the hypervisor and what Vagrant needs for it; a restart or a new login last, so everything else is done first. - recommended_
engine - The engine a setup installs in one click on
os: Docker Desktop on macOS and Windows, Docker Engine on Linux. - schedule_
restart - Asks Windows to restart in
after(shutdown /r /t <s> /c <note>), its countdown showingnote. A restart scheduled already isRestart::AlreadyScheduled, not a failure. - share_
script - The root script that writes
OPTIONtoOPTION_FILEinmodprobe_d, then, whenreloadnames KVM’s CPU module (kvm_intel,kvm_amd), unloads it andkvmand loads it again, which loadskvmwith the option. An unload modprobe refuses (a module in use) leaves the option for the next restart; the CPU module is loaded again either way. - share_
step - The step that sets KVM on
hostto share the CPU’s virtualization, elevated byelevation: its modules loaded again when nothing uses KVM now (kvm::in_use). - share_
virtualization - Sets KVM to share the CPU’s virtualization (
share_step, each line it prints handed toon_line), then reads when VirtualBox can use it. Nothing runs where KVM doesn’t hold it. - sharing
- When VirtualBox can use the CPU’s virtualization on the context’s host, as detection reads it now: none when KVM holds it and isn’t set to share it.
- walk
- Walks the setup
wantedfrommachineand its options: the next step of the plan not done yet (a restart or a new login last, never run) run bysteps, told toon, the machine checked again after it, until none is left, or (on_failure) one fails.