install

package
v0.216.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package install serves the one-line worker installer (design 2026-11-14-traceability-and-machine-onboarding-design.md §3): the public scripts /install.sh and /install.ps1, and the manifest that names this server's own version for a platform together with its sha256.

The scripts carry NO credential — only the server's address. Joining is the existing anonymous self-enrollment flow (`gofer worker join`): the machine asks to be admitted, prints a pairing code, and a person approves it in the console. The installer's own integrity protection is the checksum from the manifest: a missing checksum is a hard failure, never a silent unverified install.

Index

Constants

View Source
const (
	ScriptSh  = "install.sh"
	ScriptPS1 = "install.ps1"
)

Script names a template ships under. They are also the route suffixes (/install.sh).

Variables

View Source
var (
	// ErrNoReleaseVersion — the server runs a build that is not a release (a "dev" or
	// bare-commit build), so no release carries its exact version.
	ErrNoReleaseVersion = errors.New("this server's build is not a release version")
	// ErrNoChecksum — the source has no sha256 for that binary: the download could not be
	// verified, so the installer refuses to run, and the manifest refuses to offer it.
	ErrNoChecksum = errors.New("the update source published no sha256 for that binary")
)

Errors the manifest answers 404 for: nothing is wrong with the request, but this source cannot supply a verifiable binary.

Functions

func ContentType

func ContentType(name string) string

ContentType is the media type a script is served with.

func Script

func Script(name, server string) ([]byte, error)

Script returns the installer script named name with the server address filled in. The result holds exactly the server's address: no credential, no version, no path of this machine.

Types

type Manifest

type Manifest struct {
	Version string `json:"version"`
	OS      string `json:"os"`
	Arch    string `json:"arch"`
	// URL is the binary (or its release archive) on the configured update source.
	URL string `json:"url"`
	// Name is the file the URL serves; an archive is one of the .tar.gz / .zip layouts
	// Download knows, and the scripts unpack those before hashing.
	Name string `json:"name"`
	// SHA256 is the published checksum of the BINARY inside Name.
	SHA256 string `json:"sha256"`
	// Server is the address the scripts join (server.web_base_url, else the request's).
	Server string `json:"server"`
}

Manifest is the answer of GET /install/manifest: where to download THIS server's version for one platform, its sha256, and the file name the URL serves.

func ManifestFor

func ManifestFor(ctx context.Context, src Resolver, req Request) (Manifest, error)

ManifestFor resolves the manifest: this server's release version for the platform, from the update source's own metadata (the mirror's latest.yaml, or the GitHub release's). It fails rather than offering a download nothing can verify.

type Request

type Request struct {
	Version string // this server's build version (buildinfo.Info.Version)
	OS      string
	Arch    string
	Server  string // the address the scripts call back to
}

Request is what a manifest is resolved for. An empty OS / Arch means this server's own platform.

type Resolver

type Resolver interface {
	AssetForVersion(ctx context.Context, goos, goarch, version string) (updatecheck.Asset, error)
}

Resolver is the release source the manifest resolves this server's version from (*updatecheck.Checker in the server).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL