Documentation
¶
Overview ¶
Package installer owns initial preflight, lifecycle, sequencing and completion.
Index ¶
- func FormatPreflightReport(results []PreflightResult) string
- func HandoffToAdminConsole()
- func RecommendDbCache(memBytes uint64) int
- func RunInstall(opts InstallOptions, frontend InstallFrontend) error
- func RunPreflight(checkMachine bool) (host.SSHObservation, error)
- func SetVersion(v string)
- func StageBoardAll() error
- type Hardware
- type InstallDecisions
- type InstallEvent
- type InstallFrontend
- type InstallOptions
- type InstallSession
- type InstallStep
- type InstallStepView
- type InstallView
- type InteractiveInput
- type PreflightResult
- type RunOutcome
- type RunResult
- type StepKind
- type StepPhase
- type StepStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatPreflightReport ¶
func FormatPreflightReport(results []PreflightResult) string
FormatPreflightReport renders the full check list with every failure's reason.
func HandoffToAdminConsole ¶
func HandoffToAdminConsole()
HandoffToAdminConsole opens the owner TUI through a separate pseudo-terminal. runuser supplies the identity, login environment and PAM session. The original terminal retains its owner, and the original SSH login retains its identity. Installation is already complete; failure leaves connection instructions.
func RecommendDbCache ¶
RecommendDbCache maps measured memory, in bytes, to Bitcoin Core's dbcache, which Core reads in MiB. Unknown memory (zero) gets the small cache.
func RunInstall ¶
func RunInstall(opts InstallOptions, frontend InstallFrontend) error
RunInstall is the `sudo vpn install` entry point.
func RunPreflight ¶
func RunPreflight(checkMachine bool) (host.SSHObservation, error)
RunPreflight reports all failed checks before lifecycle initialization. The returned SSH observation describes preflight time, not the effective owner policy that installation will establish and verify later.
func SetVersion ¶
func SetVersion(v string)
func StageBoardAll ¶
func StageBoardAll() error
StageBoardAll builds the complete board at install time: every fact that exists on this box right now. Facts whose source does not exist yet are SKIPPED, not failed; a fresh box has no wallet macaroon until the operator creates the wallet (that moment stages it), and no Syncthing facts until Syncthing is installed.
Types ¶
type Hardware ¶
type Hardware struct {
MemoryBytes uint64 // MemTotal
DiskBytes uint64 // filesystem holding the data dir
}
Hardware is the measured machine, in bytes. A zero field was not measured.
func DetectHardware ¶
func DetectHardware() Hardware
DetectHardware measures the machine. A measurement that fails leaves its field zero, which the checks and RecommendDbCache treat as unknown.
type InstallDecisions ¶
type InstallDecisions struct {
// Password is validated using the initial login-password policy.
Password loginpassword.Password
// GeneratedPassword is set only on the --unattended path, the only
// place a random password is generated. It is printed once at the end
// of the run, never logged.
GeneratedPassword string
// PasswordApplied is set by the identity step after chpasswd
// succeeded. The generated password is printed only when this is set.
// On a resume that skips the identity step from the ledger, or an
// --until=bake run that leaves it out, this pass generated a password
// that was never applied, and printing it would hand the owner a
// password that does not work.
PasswordApplied bool
// DbCacheMB is the database cache recorded for this install.
DbCacheMB int
}
InstallDecisions carries the install's decisions into the engine steps. Collected before the steps run (interactively or by the unattended defaults) and read by step closures at execution.
type InstallEvent ¶
type InstallEvent struct {
Index int
Status StepStatus
Err error
Final bool
Result RunResult
CompletionErr error
}
InstallEvent reports ordered progress or the engine's terminal outcome.
type InstallFrontend ¶
type InstallFrontend func(InstallView, *InstallSession) (openConsole bool, err error)
InstallFrontend presents one root installation session. Returning requests a graceful stop, and the installer joins admitted work before releasing its lock.
type InstallOptions ¶
type InstallOptions struct {
// Network from --testnet4 or --signet ("" = mainnet for a pristine host,
// or keep the interrupted lifecycle's recorded answer).
Network string
// Unattended runs without a TUI or prompts and generates a login password.
// SSH keys are configured by the owner after installation.
Unattended bool
// UntilBake runs only PhaseBake steps, for building an image. It
// requires Unattended. The run ends without terminal ledger status,
// handoff or verification banner, because first-boot steps are still
// owed.
UntilBake bool
}
InstallOptions carries the `vpn install` command line.
type InstallSession ¶
type InstallSession struct {
// contains filtered or unexported fields
}
InstallSession owns one execution, independently of progress consumption. Stop prevents admission of another step. It does not kill an active subprocess or undo its changes. Forced process death still relies on lifecycle resume.
func (*InstallSession) Events ¶
func (s *InstallSession) Events() <-chan InstallEvent
Events supplies one ordered stream for the frontend's single observer.
func (*InstallSession) Start ¶
func (s *InstallSession) Start(input InteractiveInput) error
Start validates and freezes choices before admitting the first step. It may be retried after a decision error, but a started or stopped session is final.
func (*InstallSession) Stop ¶
func (s *InstallSession) Stop()
Stop requests a stop after the admitted step and its ledger publication.
type InstallStep ¶
type InstallStep struct {
// Key is the stable, versionless ledger key ("tor.install",
// "btc.download"). Names carry versions and copy edits; keys
// identify the step across binary versions.
Key string
// Name is display-only.
Name string
Fn func() error
Kind StepKind
Group string // resume-atomic pipeline; "" = self-contained
Phase StepPhase
Status StepStatus
Err error
}
func FilterPhase ¶
func FilterPhase(steps []InstallStep, until StepPhase) []InstallStep
FilterPhase returns the steps whose Phase is at or before until — the image pipeline's `--until=bake` slice (ruling iv plumbing; the CLI that passes a phase arrives with the commit-6 dispatch).
type InstallStepView ¶
type InstallStepView struct {
Name string
Status StepStatus
Err error
}
InstallStepView describes a step without granting execution authority.
type InstallView ¶
type InstallView struct {
NeedIdentity bool
Steps []InstallStepView
Address string
}
InstallView contains observations and presentation data, never ledger access or executable installation steps.
type InteractiveInput ¶
type InteractiveInput struct {
Password loginpassword.Password
}
InteractiveInput holds the owner's password, the one choice the interactive install asks for.
type PreflightResult ¶
PreflightResult is one check's outcome. Err == nil means pass.
type RunOutcome ¶
type RunOutcome int
RunOutcome distinguishes the three ways a runner ends. Terminal lifecycle status is derived only from RunComplete plus successful finalization.
const ( RunComplete RunOutcome = iota RunFailed RunInterrupted )
type RunResult ¶
type RunResult struct {
Outcome RunOutcome
StepName string // failed / interrupted-at step ("" if complete)
StepNum int // 1-based
Total int
Err error // the failed step's error
}
func RunInstallUnattended ¶
func RunInstallUnattended( steps []InstallStep, version string, ledger *installLedger, ledgerPath string, ) (RunResult, error)
RunInstallUnattended executes steps with no TUI: one plain line per step to stdout, same runner, same ledger, same log trail. Its consumers are `vpn install --unattended` and the image build pipeline. Interruption needs no handling here: a killed process leaves the ledger truthful by write ordering.
type StepPhase ¶
type StepPhase int
StepPhase classifies a step for the image pipeline (ruling iv): bake steps run at image-build time, first-boot steps must run on the deployed box (identity, hardware, SSH, and machine-specific staging).
type StepStatus ¶
type StepStatus int
const ( StepPending StepStatus = iota StepRunning StepDone StepFailed // StepSkipped renders a resume skip: the ledger records a // prior completion, the step did not execute this pass. StepSkipped )