install

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 34 Imported by: 1 module, 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

Index

Constants

View Source
const (
	MethodScript = "script"
	MethodWinGet = "winget"
	MethodGit    = "git"
)

Install methods the install core stamps for the script ladder, the WinGet nested installer and a source checkout

View Source
const (
	ReleaseOlder = -1
	ReleaseSame  = 0
	ReleaseNewer = 1
)

Order of a release against the installed build

View Source
const BootstrapMarkerName = ".icebath-bootstrap-complete"

Bootstrap complete marker file name inside the install tree

View Source
const DefaultRepoURL = "https://github.com/nickheyer/icebath.git"

Repository the installer downloads releases from unless ICEBATH_REPO_URL names another

View Source
const InstallDirName = "icebath-agent"

Directory name of the install tree under the home

View Source
const InstallMethodFile = ".install_method"

Stamp file beside the binary naming how the tree was installed

View Source
const InstallRepoFile = ".install_repo"

File beside the binary naming the repository a release install updates from

View Source
const ShellPathMarker = "# Icebath Agent command"

Comment line the installer writes above each PATH line it appends

View Source
const (
	UninstallEntryKey = `HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\nickheyer.icebath`
)

Apps and Features key and identity WinGet matches against the manifest's AppsAndFeaturesEntries

Variables

View Source
var ErrUnknownBuild = errors.New("the release this binary was built from is unknown")

Failure of an install whose build names neither a release tag nor a commit an order can be read from

View Source
var ReleaseCompanionFiles = []string{"cli-config.yaml.example", ".env.example"}

Files a release archive carries beside the binary that an install keeps next to it, the commented config templates

Functions

func ApplyRelease

func ApplyRelease(ctx context.Context, dir string, target *ReleaseTarget, out io.Writer) error

Downloads the target release's archive for this host, verifies its checksum and swaps its binary and config templates into dir

func BootstrapMarkerPath

func BootstrapMarkerPath(installRoot string) string

Bootstrap complete marker of an install tree

func CheckoutUpdateCommands

func CheckoutUpdateCommands() []string

Commands that update a source checkout from inside it on this platform

func ChecksumFor

func ChecksumFor(body []byte, name string) string

sha256 of name in a checksums.txt body, empty when it is not listed

func CopySkillsNoClobber

func CopySkillsNoClobber(src, dst string) error

Copies a checkout's bundled skills into the home skills dir without replacing anything there

func Home

func Home() string

Home the installer works in, the ICEBATH_HOME override first then the platform default

func ISO8601UTC

func ISO8601UTC(t time.Time) string

UTC ISO 8601 with milliseconds, the completedAt format every receipt writer shares

func InstallBinaryPath

func InstallBinaryPath(installDir string) string

Install binary of a tree

func InstallRootOf

func InstallRootOf(homeDir string) string

Install tree of a home

func InstalledRepository

func InstalledRepository(dir string) string

Repository an install recorded, empty when it recorded none

func InstallerCommand

func InstallerCommand() string

Command that installs icebath with the installer on this platform

func InstallerCreated

func InstallerCreated(root string) bool

Whether the tree carries the bootstrap marker the installer writes when it completes an install there

func IsFullSHA

func IsFullSHA(value string) bool

Reports a 40 hex digit lowercase commit

func IsSourceCheckout

func IsSourceCheckout(root string) bool

Whether the tree holds the source of the module this binary was built from

func LatestStableRelease

func LatestStableRelease(ctx context.Context, r Repo) string

Latest stable release tag, the API first, then the latest redirect, then the highest advertised vX.Y.Z tag

func LsRemote

func LsRemote(ctx context.Context, r Repo) (map[string]string, error)

Refs the repository advertises over smart HTTP, ref name to object id

func Main

func Main(opts Options, stdout, stderr *os.File) int

Runs the install ladder and returns its exit status

func ReleaseArchiveName

func ReleaseArchiveName(version, goos, goarch string) string

Release archive name of a version for goos and goarch, the zip on Windows and the gzipped tar elsewhere

func RemoveUninstallEntry

func RemoveUninstallEntry() (bool, error)

Removes nothing off Windows, which keeps no Apps and Features entries

func ReplaceFile

func ReplaceFile(src, dest string) error

Renames src over dest, moving a running Windows binary aside first

func ResolvedPathsJSON

func ResolvedPathsJSON(opts Options) (string, error)

Paths this install would use as the JSON object install.ps1 -ShowResolvedPaths prints

func SetupFromCheckout

func SetupFromCheckout(ctx context.Context, checkout string, report func(string)) error

Publishes a checkout's built binary as the icebath command, puts the user bin on PATH and seeds the skills dir

func StageNames

func StageNames() []string

Stage names of the install ladder in run order

func UnmanagedTreeDescription

func UnmanagedTreeDescription(root string) string

Names a tree the installer did not create, a source checkout as one

func ValidStableTag

func ValidStableTag(tag string) bool

Reports a vX.Y.Z tag of the stable shape

func WireShellPath

func WireShellPath(userHome, shell string, report func(string)) error

Puts the user bin on PATH in the login shell's startup files, Windows registering it through command publication

func WriteInstallMethod

func WriteInstallMethod(dir, method string) error

Writes the install method stamp beside the binary of a tree

func WriteInstalledRepository

func WriteInstalledRepository(dir, repoURL string) error

Records the repository an install's releases come from beside its binary

Types

type Event

type Event struct {
	Line   string
	Stream LogStream
}

One output line of the install on one stream

type LogStream

type LogStream string
const (
	Stdout LogStream = "stdout"
	Stderr LogStream = "stderr"
)

type Options

type Options struct {
	Channel         string
	Branch          string
	Commit          string
	Dir             string
	Home            string
	RepoURL         string
	Binary          string
	Version         string
	FromSelf        bool
	NonInteractive  bool
	Verbose         bool
	SkipBrowser     bool
	SkipComputerUse bool
	InstallMethod   string
}

Install options, the flags of the install scripts after renames

type ReleaseInfo

type ReleaseInfo struct {
	Tag    string `json:"tag"`
	Commit string `json:"commit"`
}

Release identity an installed binary reports through install-self --release-info

func InstalledRelease

func InstalledRelease(ctx context.Context, binary string) ReleaseInfo

Asks an installed binary which release it is, empty when it cannot answer

type ReleasePlan

type ReleasePlan struct {
	Installed ReleaseInfo
	Target    *ReleaseTarget
	Order     int
	Ahead     int
}

Release an update would move a binary install to and its order against the installed build

func PlanRelease

func PlanRelease(ctx context.Context, dir, repoURL string, q ReleaseQuery) (*ReleasePlan, error)

Selects the release the query names and orders it against the binary installed in dir

type ReleaseQuery

type ReleaseQuery struct {
	Commit string
	Stable bool
	Branch string
}

Releases an update chooses from, a pinned commit first, then the latest stable release, then the newest of a branch

type ReleaseTarget

type ReleaseTarget struct {
	Tag    string
	Commit string
	Assets []releaseAsset
	Repo   Repo
}

Release chosen for an install, its commit when known and its assets when the API answered

func (*ReleaseTarget) AssetDigest

func (t *ReleaseTarget) AssetDigest(name string) string

sha256 an API asset digest names, empty when the listing carries none

func (*ReleaseTarget) AssetURL

func (t *ReleaseTarget) AssetURL(name string) string

Download URL of a named asset, the API listing first then the conventional release path

func (*ReleaseTarget) ExpectedSHA256

func (t *ReleaseTarget) ExpectedSHA256(ctx context.Context, name string) (string, error)

Verified sha256 of a release asset from checksums.txt, refusing a disagreeing API digest

type Repo

type Repo struct {
	Web   string
	API   string
	Owner string
	Name  string
}

func ParseRepo

func ParseRepo(raw string) (Repo, error)

Web, API and identity of a repository URL in https or ssh form

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runs install stages in process, reporting every line through the sink

func NewRunner

func NewRunner(opts Options, sink func(Event)) (*Runner, error)

Runner for the options, the home and install dir resolved and exported like install.sh does

func (*Runner) RunStage

func (r *Runner) RunStage(ctx context.Context, name string) (int, error)

Runs one stage and returns its exit status and failure, the interactive stages passing in a non interactive run

type StageError

type StageError struct {
	Reason string
}

Failure of one stage with its reason

func (*StageError) Error

func (e *StageError) Error() string

Jump to

Keyboard shortcuts

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