install

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 13 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 owns ChannelTerm's per-user executable installation, installation manifest, command alias, PATH integration, and uninstall lifecycle. It does not own user configuration semantics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAndRunDeferredCleanup

func ParseAndRunDeferredCleanup(args []string) error

ParseAndRunDeferredCleanup validates hidden helper arguments before entering the platform-specific cleanup routine. It exists only for the private Windows self-uninstall process and is not a public CLI contract.

func RunDeferredCleanup

func RunDeferredCleanup(uint32, string, string, string) error

RunDeferredCleanup is unavailable on Unix because a running executable can be unlinked directly.

Types

type BuildInfo

type BuildInfo struct {
	// Version is the release or development version reported by this binary.
	Version string
	// Commit is the source revision embedded at build time.
	Commit string
	// BuiltAt is the build timestamp embedded by the release process.
	BuiltAt string
}

BuildInfo identifies the currently running ChannelTerm binary. Release builds populate these values through linker flags; development builds retain explicit development provenance.

type InstallOptions

type InstallOptions struct {
	// NoPath skips adding the installation directory to the user PATH.
	NoPath bool
	// Adopt permits matching command files that have no ownership manifest.
	Adopt bool
	// AllowDowngrade permits an older stable release to replace a newer one.
	AllowDowngrade bool
}

InstallOptions controls optional and potentially destructive installation choices.

type InstallResult

type InstallResult struct {
	// Action is installed, updated, repaired, or adopted.
	Action string
	// Source is the executable from which installation was performed.
	Source string
	// Binary is the installed full-command path.
	Binary string
	// Alias is the installed short-command path.
	Alias string
	// Manifest is the ownership-record path.
	Manifest string
	// Configuration is the validated or initialized configuration path.
	Configuration string
	// PathChanged reports whether persistent user PATH state was modified.
	PathChanged bool
}

InstallResult describes the completed per-user installation.

type Manager

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

Manager performs one platform-scoped install or uninstall transaction. Construct it with NewDefault for production use.

func NewDefault

func NewDefault(build BuildInfo) (*Manager, error)

NewDefault resolves the current executable and the current user's standard installation locations without changing the filesystem.

func (*Manager) Install

func (m *Manager) Install(options InstallOptions) (_ InstallResult, returnErr error)

Install copies the running binary into the standard per-user location, creates its short command, optionally manages PATH, and initializes the existing ChannelTerm configuration lifecycle.

func (*Manager) Uninstall

func (m *Manager) Uninstall(options UninstallOptions) (UninstallResult, error)

Uninstall removes only files and PATH changes proven to be owned by the installation manifest. Purge additionally removes the known ChannelTerm configuration, device state, and local HTTP credential files.

type Manifest

type Manifest struct {
	// SchemaVersion identifies the manifest format understood by the installer.
	SchemaVersion int `json:"schema_version"`
	// Version, Commit, and BuiltAt preserve installed build provenance.
	Version string `json:"version"`
	Commit  string `json:"commit"`
	BuiltAt string `json:"built_at"`
	// InstalledAt is retained across updates; UpdatedAt changes on every install.
	InstalledAt time.Time `json:"installed_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	// BinaryPath and BinarySHA256 identify the installer-owned executable.
	BinaryPath   string `json:"binary_path"`
	BinarySHA256 string `json:"binary_sha256"`
	// AliasPath and AliasKind describe the platform's short command.
	AliasPath string `json:"alias_path"`
	AliasKind string `json:"alias_kind"`
	// Path records the persistent environment change, if ChannelTerm made one.
	Path PathRecord `json:"path"`
}

Manifest is the versioned ownership record written by the built-in installer. Paths read from it are never trusted until they match the current platform's expected layout.

type PathRecord

type PathRecord struct {
	// Managed distinguishes installer-owned entries from preexisting PATH state.
	Managed bool `json:"managed"`
	// Entry is the normalized command directory added to PATH.
	Entry string `json:"entry,omitempty"`
	// Scope is "user" for all supported production implementations.
	Scope string `json:"scope,omitempty"`
	// ShellFile and Block identify the exact Unix startup-file edit.
	ShellFile string `json:"shell_file,omitempty"`
	Block     string `json:"block,omitempty"`
	// CreatedFile reports that the Unix startup file did not previously exist.
	CreatedFile bool `json:"created_file,omitempty"`
}

PathRecord records only PATH changes made by ChannelTerm. Uninstall uses the exact record to avoid removing a path that predates the installation.

type UninstallOptions

type UninstallOptions struct {
	// Purge also removes the allowlisted default user-data files.
	Purge bool
}

UninstallOptions controls removal of user-owned runtime data. Ordinary uninstall always preserves configuration, device state, and credentials.

type UninstallResult

type UninstallResult struct {
	// Binary is the removed full-command path.
	Binary string
	// Alias is the removed short-command path.
	Alias string
	// Manifest is the removed ownership-record path.
	Manifest string
	// PathChanged reports whether persistent user PATH state was modified.
	PathChanged bool
	// Purged lists user-data files removed by an explicit purge.
	Purged []string
	// Deferred reports that Windows scheduled command removal after process exit.
	Deferred bool
}

UninstallResult describes what an uninstall removed. Deferred is true on Windows when a helper must delete the running executable after process exit.

Jump to

Keyboard shortcuts

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