Documentation
¶
Index ¶
- func FillDefaults(data *appconfig.InstallerData)
- func FilterInstaller(installer IInstaller, filters []string) bool
- func GetPlatformArchWithFallback(preferred string, fallbacks ...string) string
- func InstallerIsEnabled(i IInstaller) (bool, error)
- func InstallerWithDefaults(data *appconfig.InstallerData, installerType appconfig.InstallerType, ...) *appconfig.InstallerData
- func RunInstaller(config *appconfig.AppConfig, installer IInstaller) error
- type AptInstaller
- func (i *AptInstaller) CheckIsInstalled() (bool, error)
- func (i *AptInstaller) CheckNeedsUpdate() (bool, error)
- func (i *AptInstaller) GetBinName() string
- func (i *AptInstaller) GetData() *appconfig.InstallerData
- func (i *AptInstaller) GetOpts() *AptOpts
- func (i *AptInstaller) Install() error
- func (i *AptInstaller) Update() error
- func (i *AptInstaller) Validate() []ValidationError
- type AptOpts
- type AptPackageManager
- type BrewExitError
- type BrewInstaller
- func (i *BrewInstaller) CheckIsInstalled() (bool, error)
- func (i *BrewInstaller) CheckNeedsUpdate() (bool, error)
- func (i *BrewInstaller) GetBinName() string
- func (i *BrewInstaller) GetData() *appconfig.InstallerData
- func (i *BrewInstaller) GetFullName() string
- func (i *BrewInstaller) GetOpts() *BrewOpts
- func (i *BrewInstaller) Install() error
- func (i *BrewInstaller) Update() error
- func (i *BrewInstaller) Validate() []ValidationError
- type BrewOpts
- type DockerInstaller
- func (i *DockerInstaller) CheckIsInstalled() (bool, error)
- func (i *DockerInstaller) CheckNeedsUpdate() (bool, error)
- func (i *DockerInstaller) GetContainerName() string
- func (i *DockerInstaller) GetData() *appconfig.InstallerData
- func (i *DockerInstaller) GetOpts() *DockerOpts
- func (i *DockerInstaller) Install() error
- func (i *DockerInstaller) Update() error
- func (i *DockerInstaller) Validate() []ValidationError
- type DockerManifestList
- type DockerOpts
- type GitHubReleaseInstallStrategy
- type GitHubReleaseInstaller
- func (i *GitHubReleaseInstaller) CheckIsInstalled() (bool, error)
- func (i *GitHubReleaseInstaller) CheckNeedsUpdate() (bool, error)
- func (i *GitHubReleaseInstaller) CopyExtractedFile(out *os.File, tmpDir string) (bool, error)
- func (i *GitHubReleaseInstaller) GetBinName() string
- func (i *GitHubReleaseInstaller) GetCachedTag() (string, error)
- func (i *GitHubReleaseInstaller) GetData() *appconfig.InstallerData
- func (i *GitHubReleaseInstaller) GetDestination() string
- func (i *GitHubReleaseInstaller) GetFilename() string
- func (i *GitHubReleaseInstaller) GetInstallDir() string
- func (i *GitHubReleaseInstaller) GetLatestTag() (string, error)
- func (i *GitHubReleaseInstaller) GetOpts() *GitHubReleaseOpts
- func (i *GitHubReleaseInstaller) Install() error
- func (i *GitHubReleaseInstaller) Update() error
- func (i *GitHubReleaseInstaller) UpdateCache(tag string) error
- func (i *GitHubReleaseInstaller) Validate() []ValidationError
- type GitHubReleaseOpts
- type GitInstaller
- func (i *GitInstaller) CheckIsInstalled() (bool, error)
- func (i *GitInstaller) CheckNeedsUpdate() (bool, error)
- func (i *GitInstaller) GetData() *appconfig.InstallerData
- func (i *GitInstaller) GetDestination() string
- func (i *GitInstaller) GetInstallDir() string
- func (i *GitInstaller) GetOpts() *GitOpts
- func (i *GitInstaller) GetRepositoryUrl() string
- func (i *GitInstaller) Install() error
- func (i *GitInstaller) Update() error
- func (i *GitInstaller) Validate() []ValidationError
- type GitOpts
- type GroupInstaller
- func (i *GroupInstaller) CheckIsInstalled() (bool, error)
- func (i *GroupInstaller) CheckNeedsUpdate() (bool, error)
- func (i *GroupInstaller) GetBinName() string
- func (i *GroupInstaller) GetData() *appconfig.InstallerData
- func (i *GroupInstaller) GetOpts() *GroupOpts
- func (i *GroupInstaller) Install() error
- func (i *GroupInstaller) Update() error
- func (i *GroupInstaller) Validate() []ValidationError
- type GroupOpts
- type IInstaller
- type InstallerBase
- func (i *InstallerBase) BaseValidate() []ValidationError
- func (i *InstallerBase) GetData() *appconfig.InstallerData
- func (i *InstallerBase) HasCustomInstallCheck() bool
- func (i *InstallerBase) HasCustomUpdateCheck() bool
- func (i *InstallerBase) RunCmdAsFile(command string) error
- func (i *InstallerBase) RunCmdGetOutput(command string, args ...string) ([]byte, error)
- func (i *InstallerBase) RunCmdGetSuccess(command string, args ...string) (bool, error)
- func (i *InstallerBase) RunCmdGetSuccessPassThrough(command string, args ...string) (bool, error)
- func (i *InstallerBase) RunCmdPassThrough(command string, args ...string) error
- func (i *InstallerBase) RunCustomInstallCheck() (bool, error)
- func (i *InstallerBase) RunCustomUpdateCheck() (bool, error)
- type ManifestInstaller
- func (i *ManifestInstaller) CheckIsInstalled() (bool, error)
- func (i *ManifestInstaller) CheckNeedsUpdate() (bool, error)
- func (i *ManifestInstaller) FetchManifest() error
- func (i *ManifestInstaller) GetData() *appconfig.InstallerData
- func (i *ManifestInstaller) GetOpts() *ManifestOpts
- func (i *ManifestInstaller) Install() error
- func (i *ManifestInstaller) Update() error
- func (i *ManifestInstaller) Validate() []ValidationError
- type ManifestOpts
- type MockInstaller
- func (m *MockInstaller) CheckIsInstalled() (bool, error)
- func (m *MockInstaller) CheckNeedsUpdate() (bool, error)
- func (m *MockInstaller) GetData() *appconfig.InstallerData
- func (m *MockInstaller) Install() error
- func (m *MockInstaller) Update() error
- func (m *MockInstaller) Validate() []ValidationError
- type NpmInstaller
- func (i *NpmInstaller) CheckIsInstalled() (bool, error)
- func (i *NpmInstaller) CheckNeedsUpdate() (bool, error)
- func (i *NpmInstaller) GetBinName() string
- func (i *NpmInstaller) GetData() *appconfig.InstallerData
- func (i *NpmInstaller) GetOpts() *NpmOpts
- func (i *NpmInstaller) Install() error
- func (i *NpmInstaller) Update() error
- func (i *NpmInstaller) Validate() []ValidationError
- type NpmOpts
- type NpmPackageManager
- type PipxInstaller
- func (i *PipxInstaller) CheckIsInstalled() (bool, error)
- func (i *PipxInstaller) CheckNeedsUpdate() (bool, error)
- func (i *PipxInstaller) GetBinName() string
- func (i *PipxInstaller) GetData() *appconfig.InstallerData
- func (i *PipxInstaller) GetOpts() *PipxOpts
- func (i *PipxInstaller) Install() error
- func (i *PipxInstaller) Update() error
- func (i *PipxInstaller) Validate() []ValidationError
- type PipxOpts
- type RsyncInstaller
- func (i *RsyncInstaller) CheckIsInstalled() (bool, error)
- func (i *RsyncInstaller) CheckNeedsUpdate() (bool, error)
- func (i *RsyncInstaller) GetBinName() string
- func (i *RsyncInstaller) GetData() *appconfig.InstallerData
- func (i *RsyncInstaller) GetOpts() *RsyncOpts
- func (i *RsyncInstaller) Install() error
- func (i *RsyncInstaller) Update() error
- func (i *RsyncInstaller) Validate() []ValidationError
- type RsyncOpts
- type ShellInstaller
- func (i *ShellInstaller) CheckIsInstalled() (bool, error)
- func (i *ShellInstaller) CheckNeedsUpdate() (bool, error)
- func (i *ShellInstaller) GetBinName() string
- func (i *ShellInstaller) GetData() *appconfig.InstallerData
- func (i *ShellInstaller) GetOpts() *ShellOpts
- func (i *ShellInstaller) Install() error
- func (i *ShellInstaller) Update() error
- func (i *ShellInstaller) Validate() []ValidationError
- type ShellOpts
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FillDefaults ¶ added in v1.5.0
func FillDefaults(data *appconfig.InstallerData)
FillDefaults initializes nil fields in an InstallerData object with empty values.
func FilterInstaller ¶ added in v1.5.0
func FilterInstaller(installer IInstaller, filters []string) bool
FilterInstaller determines whether an installer should be included based on a list of filters. Filters can be positive (e.g., "name") or negative (e.g., "!name"). Filters can also target specific fields like type (e.g., "type:brew") or tags (e.g., "tag:database").
func GetPlatformArchWithFallback ¶ added in v1.10.0
GetPlatformArchWithFallback attempts to determine the best architecture for a Docker image, considering a preferred architecture and a list of fallbacks. It inspects the manifest of a sample image ("ghcr.io/open-webui/open-webui:main") to check for available architectures.
func InstallerIsEnabled ¶ added in v1.6.0
func InstallerIsEnabled(i IInstaller) (bool, error)
InstallerIsEnabled checks if an installer is enabled. The "enabled" field in the installer data can be a boolean string ("true", "false") or a command. If it's a command, the installer is enabled if the command runs successfully (exit code 0).
func InstallerWithDefaults ¶
func InstallerWithDefaults( data *appconfig.InstallerData, installerType appconfig.InstallerType, defaults *appconfig.AppConfigDefaults, ) *appconfig.InstallerData
InstallerWithDefaults applies default configurations to an installer data object. It first applies base defaults using FillDefaults, and then applies type-specific defaults.
func RunInstaller ¶
func RunInstaller(config *appconfig.AppConfig, installer IInstaller) error
RunInstaller executes the installation or update process for a given installer.
Types ¶
type AptInstaller ¶ added in v1.3.0
type AptInstaller struct {
InstallerBase
// Config is the application configuration.
Config *appconfig.AppConfig
// Info is the installer data.
Info *appconfig.InstallerData
// PackageManager is the package manager to use (apt or apk).
PackageManager AptPackageManager
}
AptInstaller is an installer for apt and apk packages.
func NewAptInstaller ¶ added in v1.3.0
func NewAptInstaller(cfg *appconfig.AppConfig, installer *appconfig.InstallerData) *AptInstaller
NewAptInstaller creates a new AptInstaller.
func (*AptInstaller) CheckIsInstalled ¶ added in v1.3.0
func (i *AptInstaller) CheckIsInstalled() (bool, error)
CheckIsInstalled implements IInstaller.
func (*AptInstaller) CheckNeedsUpdate ¶ added in v1.3.0
func (i *AptInstaller) CheckNeedsUpdate() (bool, error)
CheckNeedsUpdate implements IInstaller.
func (*AptInstaller) GetBinName ¶ added in v1.3.0
func (i *AptInstaller) GetBinName() string
GetBinName returns the binary name for the installer. It uses the BinName from the installer data if provided, otherwise it uses the installer name.
func (*AptInstaller) GetData ¶ added in v1.5.0
func (i *AptInstaller) GetData() *appconfig.InstallerData
GetData implements IInstaller.
func (*AptInstaller) GetOpts ¶ added in v1.3.0
func (i *AptInstaller) GetOpts() *AptOpts
GetOpts returns the parsed options for the AptInstaller.
func (*AptInstaller) Install ¶ added in v1.3.0
func (i *AptInstaller) Install() error
Install implements IInstaller.
func (*AptInstaller) Update ¶ added in v1.3.0
func (i *AptInstaller) Update() error
Update implements IInstaller.
func (*AptInstaller) Validate ¶ added in v1.9.0
func (i *AptInstaller) Validate() []ValidationError
Validate validates the installer configuration.
type AptOpts ¶ added in v1.3.0
type AptOpts struct {
}
AptOpts represents options for the AptInstaller.
type AptPackageManager ¶ added in v1.10.0
type AptPackageManager string
AptPackageManager represents a package manager type.
const ( PackageManagerApk AptPackageManager = "apk" // PackageManagerApk represents the apk package manager. PackageManagerApt AptPackageManager = "apt" // PackageManagerApt represents the apt package manager. )
Constants for supported package managers.
type BrewExitError ¶ added in v1.10.0
type BrewExitError struct {
ExitCode int
}
BrewExitError represents a failure exit code from a simulated `brew` call.
func (*BrewExitError) Error ¶ added in v1.10.0
func (e *BrewExitError) Error() string
type BrewInstaller ¶
type BrewInstaller struct {
InstallerBase
// Config is the application configuration.
Config *appconfig.AppConfig
// Info is the installer data.
Info *appconfig.InstallerData
}
BrewInstaller is an installer for Homebrew packages.
func NewBrewInstaller ¶
func NewBrewInstaller(cfg *appconfig.AppConfig, installer *appconfig.InstallerData) *BrewInstaller
NewBrewInstaller creates a new BrewInstaller.
func (*BrewInstaller) CheckIsInstalled ¶
func (i *BrewInstaller) CheckIsInstalled() (bool, error)
CheckIsInstalled implements IInstaller.
func (*BrewInstaller) CheckNeedsUpdate ¶
func (i *BrewInstaller) CheckNeedsUpdate() (bool, error)
CheckNeedsUpdate implements IInstaller.
func (*BrewInstaller) GetBinName ¶
func (i *BrewInstaller) GetBinName() string
GetBinName returns the binary name for the installer. It uses the BinName from the installer data if provided, otherwise it uses the installer name.
func (*BrewInstaller) GetData ¶ added in v1.5.0
func (i *BrewInstaller) GetData() *appconfig.InstallerData
GetData implements IInstaller.
func (*BrewInstaller) GetFullName ¶ added in v1.9.4
func (i *BrewInstaller) GetFullName() string
GetFullName returns the full name of the package, including the tap if specified.
func (*BrewInstaller) GetOpts ¶
func (i *BrewInstaller) GetOpts() *BrewOpts
GetOpts returns the parsed options for the BrewInstaller.
func (*BrewInstaller) Install ¶
func (i *BrewInstaller) Install() error
Install implements IInstaller.
func (*BrewInstaller) Validate ¶ added in v1.9.0
func (i *BrewInstaller) Validate() []ValidationError
Validate validates the installer configuration.
type BrewOpts ¶
type BrewOpts struct {
// Tap is the Homebrew tap to use for the package.
Tap *string
}
BrewOpts represents options for the BrewInstaller.
type DockerInstaller ¶ added in v1.10.0
type DockerInstaller struct {
InstallerBase
// Config is the application configuration.
Config *appconfig.AppConfig
// Info is the installer data.
Info *appconfig.InstallerData
}
DockerInstaller is an installer for Docker images.
func NewDockerInstaller ¶ added in v1.10.0
func NewDockerInstaller(cfg *appconfig.AppConfig, installer *appconfig.InstallerData) *DockerInstaller
NewDockerInstaller creates a new DockerInstaller.
func (*DockerInstaller) CheckIsInstalled ¶ added in v1.10.0
func (i *DockerInstaller) CheckIsInstalled() (bool, error)
CheckIsInstalled implements IInstaller.
func (*DockerInstaller) CheckNeedsUpdate ¶ added in v1.10.0
func (i *DockerInstaller) CheckNeedsUpdate() (bool, error)
CheckNeedsUpdate implements IInstaller.
func (*DockerInstaller) GetContainerName ¶ added in v1.10.0
func (i *DockerInstaller) GetContainerName() string
GetContainerName returns the name of the Docker container. It uses the BinName from the installer data if provided, otherwise it uses the installer name.
func (*DockerInstaller) GetData ¶ added in v1.10.0
func (i *DockerInstaller) GetData() *appconfig.InstallerData
GetData implements IInstaller.
func (*DockerInstaller) GetOpts ¶ added in v1.10.0
func (i *DockerInstaller) GetOpts() *DockerOpts
GetOpts returns the parsed options for the DockerInstaller.
func (*DockerInstaller) Install ¶ added in v1.10.0
func (i *DockerInstaller) Install() error
Install implements IInstaller.
func (*DockerInstaller) Update ¶ added in v1.10.0
func (i *DockerInstaller) Update() error
Update implements IInstaller.
func (*DockerInstaller) Validate ¶ added in v1.10.0
func (i *DockerInstaller) Validate() []ValidationError
Validate validates the installer configuration.
type DockerManifestList ¶ added in v1.10.0
type DockerManifestList struct {
SchemaVersion int `json:"schemaVersion"`
MediaType string `json:"mediaType"`
Manifests []struct {
Digest string `json:"digest"`
Platform struct {
Architecture string `json:"architecture"`
OS string `json:"os"`
} `json:"platform"`
} `json:"manifests"`
}
DockerManifestList represents the structure of a Docker manifest list.
type DockerOpts ¶ added in v1.10.0
type DockerOpts struct {
// Flags is a string of flags to pass to the `docker run` command.
Flags *string
// Platform is a platform-specific map of Docker platform strings (e.g., "linux/amd64").
Platform *platform.PlatformMap[string]
}
DockerOpts represents options for the DockerInstaller.
type GitHubReleaseInstallStrategy ¶ added in v1.8.0
type GitHubReleaseInstallStrategy string
GitHubReleaseInstallStrategy represents the installation strategy for a GitHub release.
const ( GitHubReleaseInstallStrategyNone GitHubReleaseInstallStrategy = "none" // GitHubReleaseInstallStrategyNone means no special handling, just download the file. GitHubReleaseInstallStrategyTar GitHubReleaseInstallStrategy = "tar" // GitHubReleaseInstallStrategyTar means extract a tar archive. GitHubReleaseInstallStrategyZip GitHubReleaseInstallStrategy = "zip" // GitHubReleaseInstallStrategyZip means extract a zip archive. )
Constants for GitHub release installation strategies.
type GitHubReleaseInstaller ¶ added in v1.8.0
type GitHubReleaseInstaller struct {
InstallerBase
// Config is the application configuration.
Config *appconfig.AppConfig
// Info is the installer data.
Info *appconfig.InstallerData
}
GitHubReleaseInstaller is an installer for GitHub releases.
func NewGitHubReleaseInstaller ¶ added in v1.8.0
func NewGitHubReleaseInstaller(cfg *appconfig.AppConfig, installer *appconfig.InstallerData) *GitHubReleaseInstaller
NewGitHubReleaseInstaller creates a new GitHubReleaseInstaller.
func (*GitHubReleaseInstaller) CheckIsInstalled ¶ added in v1.8.0
func (i *GitHubReleaseInstaller) CheckIsInstalled() (bool, error)
CheckIsInstalled implements IInstaller.
func (*GitHubReleaseInstaller) CheckNeedsUpdate ¶ added in v1.8.0
func (i *GitHubReleaseInstaller) CheckNeedsUpdate() (bool, error)
CheckNeedsUpdate implements IInstaller.
func (*GitHubReleaseInstaller) CopyExtractedFile ¶ added in v1.8.0
CopyExtractedFile copies the extracted file from a temporary directory to the final destination.
func (*GitHubReleaseInstaller) GetBinName ¶ added in v1.8.0
func (i *GitHubReleaseInstaller) GetBinName() string
GetBinName returns the binary name for the installer. It uses the BinName from the installer data if provided, otherwise it uses the base name of the installer name.
func (*GitHubReleaseInstaller) GetCachedTag ¶ added in v1.8.0
func (i *GitHubReleaseInstaller) GetCachedTag() (string, error)
GetCachedTag retrieves the cached tag for the release from the cache directory.
func (*GitHubReleaseInstaller) GetData ¶ added in v1.8.0
func (i *GitHubReleaseInstaller) GetData() *appconfig.InstallerData
GetData implements IInstaller.
func (*GitHubReleaseInstaller) GetDestination ¶ added in v1.8.0
func (i *GitHubReleaseInstaller) GetDestination() string
GetDestination returns the destination directory for the release asset. It uses the Destination from the installer options if provided, otherwise it defaults to the current working directory.
func (*GitHubReleaseInstaller) GetFilename ¶ added in v1.8.0
func (i *GitHubReleaseInstaller) GetFilename() string
GetFilename returns the filename to download from the release, resolved for the current platform.
func (*GitHubReleaseInstaller) GetInstallDir ¶ added in v1.8.0
func (i *GitHubReleaseInstaller) GetInstallDir() string
GetInstallDir returns the installation directory for the release asset. For GitHub releases, this is the same as the destination directory.
func (*GitHubReleaseInstaller) GetLatestTag ¶ added in v1.8.0
func (i *GitHubReleaseInstaller) GetLatestTag() (string, error)
func (*GitHubReleaseInstaller) GetOpts ¶ added in v1.8.0
func (i *GitHubReleaseInstaller) GetOpts() *GitHubReleaseOpts
GetOpts returns the parsed options for the GitHubReleaseInstaller.
func (*GitHubReleaseInstaller) Install ¶ added in v1.8.0
func (i *GitHubReleaseInstaller) Install() error
Install implements IInstaller.
func (*GitHubReleaseInstaller) Update ¶ added in v1.8.0
func (i *GitHubReleaseInstaller) Update() error
Update implements IInstaller.
func (*GitHubReleaseInstaller) UpdateCache ¶ added in v1.8.0
func (i *GitHubReleaseInstaller) UpdateCache(tag string) error
UpdateCache updates the cached tag for the release in the cache directory.
func (*GitHubReleaseInstaller) Validate ¶ added in v1.9.0
func (i *GitHubReleaseInstaller) Validate() []ValidationError
Validate validates the installer configuration.
type GitHubReleaseOpts ¶ added in v1.8.0
type GitHubReleaseOpts struct {
// Repository is the GitHub repository (e.g., "owner/repo").
Repository *string
// Destination is the directory where the release asset will be installed.
Destination *string
// DownloadFilename is a platform-specific map of the filename to download from the release.
// Placeholders {tag} and {version} can be used in the filename.
DownloadFilename *platform.PlatformMap[string]
// Strategy is the installation strategy to use (none, tar, zip).
Strategy *GitHubReleaseInstallStrategy
}
GitHubReleaseOpts represents options for the GitHubReleaseInstaller.
type GitInstaller ¶ added in v1.4.0
type GitInstaller struct {
InstallerBase
// Config is the application configuration.
Config *appconfig.AppConfig
// Info is the installer data.
Info *appconfig.InstallerData
}
GitInstaller is an installer for Git repositories.
func NewGitInstaller ¶ added in v1.4.0
func NewGitInstaller(cfg *appconfig.AppConfig, installer *appconfig.InstallerData) *GitInstaller
NewGitInstaller creates a new GitInstaller.
func (*GitInstaller) CheckIsInstalled ¶ added in v1.4.0
func (i *GitInstaller) CheckIsInstalled() (bool, error)
CheckIsInstalled implements IInstaller.
func (*GitInstaller) CheckNeedsUpdate ¶ added in v1.4.0
func (i *GitInstaller) CheckNeedsUpdate() (bool, error)
CheckNeedsUpdate implements IInstaller.
func (*GitInstaller) GetData ¶ added in v1.5.0
func (i *GitInstaller) GetData() *appconfig.InstallerData
GetData implements IInstaller.
func (*GitInstaller) GetDestination ¶ added in v1.4.0
func (i *GitInstaller) GetDestination() string
GetDestination returns the destination directory for the Git repository. It uses the Destination from the installer options if provided, otherwise it defaults to the current working directory.
func (*GitInstaller) GetInstallDir ¶ added in v1.4.0
func (i *GitInstaller) GetInstallDir() string
GetInstallDir returns the full path to the directory where the repository will be cloned. This is a combination of the destination directory and the base name of the repository.
func (*GitInstaller) GetOpts ¶ added in v1.4.0
func (i *GitInstaller) GetOpts() *GitOpts
GetOpts returns the parsed options for the GitInstaller.
func (*GitInstaller) GetRepositoryUrl ¶ added in v1.4.0
func (i *GitInstaller) GetRepositoryUrl() string
GetRepositoryUrl returns the URL of the Git repository. If the name in the installer data is a valid Git URL, it's returned directly. Otherwise, it's assumed to be a GitHub repository name (e.g., "owner/repo").
func (*GitInstaller) Install ¶ added in v1.4.0
func (i *GitInstaller) Install() error
Install implements IInstaller.
func (*GitInstaller) Update ¶ added in v1.4.0
func (i *GitInstaller) Update() error
Update implements IInstaller.
func (*GitInstaller) Validate ¶ added in v1.9.0
func (i *GitInstaller) Validate() []ValidationError
Validate validates the installer configuration.
type GitOpts ¶ added in v1.4.0
type GitOpts struct {
// Destination is the directory where the repository will be cloned.
Destination *string
// Ref is the Git reference (branch, tag, or commit) to checkout.
Ref *string
}
GitOpts represents options for the GitInstaller.
type GroupInstaller ¶
type GroupInstaller struct {
InstallerBase
// Config is the application configuration.
Config *appconfig.AppConfig
// Data is the installer data.
Data *appconfig.InstallerData
}
GroupInstaller is an installer that groups other installers.
func NewGroupInstaller ¶
func NewGroupInstaller(cfg *appconfig.AppConfig, installer *appconfig.InstallerData) *GroupInstaller
NewGroupInstaller creates a new GroupInstaller.
func (*GroupInstaller) CheckIsInstalled ¶
func (i *GroupInstaller) CheckIsInstalled() (bool, error)
CheckIsInstalled implements IInstaller.
func (*GroupInstaller) CheckNeedsUpdate ¶
func (i *GroupInstaller) CheckNeedsUpdate() (bool, error)
CheckNeedsUpdate implements IInstaller.
func (*GroupInstaller) GetBinName ¶
func (i *GroupInstaller) GetBinName() string
GetBinName returns the binary name for the installer. It uses the BinName from the installer data if provided, otherwise it uses the installer name.
func (*GroupInstaller) GetData ¶ added in v1.5.0
func (i *GroupInstaller) GetData() *appconfig.InstallerData
GetData implements IInstaller.
func (*GroupInstaller) GetOpts ¶
func (i *GroupInstaller) GetOpts() *GroupOpts
GetOpts returns the parsed options for the GroupInstaller.
func (*GroupInstaller) Install ¶
func (i *GroupInstaller) Install() error
Install implements IInstaller.
func (*GroupInstaller) Update ¶
func (i *GroupInstaller) Update() error
Update implements IInstaller.
func (*GroupInstaller) Validate ¶ added in v1.9.0
func (i *GroupInstaller) Validate() []ValidationError
Validate validates the installer configuration.
type IInstaller ¶
type IInstaller interface {
// GetData returns the installer data.
GetData() *appconfig.InstallerData
// CheckIsInstalled checks if the software is already installed.
CheckIsInstalled() (bool, error)
// CheckNeedsUpdate checks if an update is available for the software.
CheckNeedsUpdate() (bool, error)
// Install installs the software.
Install() error
// Update updates the software.
Update() error
// Validate validates the installer configuration.
Validate() []ValidationError
}
IInstaller defines the interface for all installers.
func GetInstaller ¶
func GetInstaller(config *appconfig.AppConfig, data *appconfig.InstallerData) (IInstaller, error)
GetInstaller returns an IInstaller instance based on the installer type.
type InstallerBase ¶ added in v1.8.0
type InstallerBase struct {
// Data is the installer data.
Data *appconfig.InstallerData
}
InstallerBase provides a base implementation for common installer functionality.
func (*InstallerBase) BaseValidate ¶ added in v1.9.0
func (i *InstallerBase) BaseValidate() []ValidationError
BaseValidate performs basic validation common to all installers.
func (*InstallerBase) GetData ¶ added in v1.8.0
func (i *InstallerBase) GetData() *appconfig.InstallerData
GetData returns the installer data.
func (*InstallerBase) HasCustomInstallCheck ¶ added in v1.8.0
func (i *InstallerBase) HasCustomInstallCheck() bool
HasCustomInstallCheck checks if a custom install check command is defined.
func (*InstallerBase) HasCustomUpdateCheck ¶ added in v1.8.0
func (i *InstallerBase) HasCustomUpdateCheck() bool
HasCustomUpdateCheck checks if a custom update check command is defined.
func (*InstallerBase) RunCmdAsFile ¶ added in v1.8.0
func (i *InstallerBase) RunCmdAsFile(command string) error
RunCmdAsFile runs a command as a temporary file.
func (*InstallerBase) RunCmdGetOutput ¶ added in v1.8.0
func (i *InstallerBase) RunCmdGetOutput(command string, args ...string) ([]byte, error)
RunCmdGetOutput runs a command and returns its output.
func (*InstallerBase) RunCmdGetSuccess ¶ added in v1.8.0
func (i *InstallerBase) RunCmdGetSuccess(command string, args ...string) (bool, error)
RunCmdGetSuccess runs a command and returns true if it succeeds (exit code 0).
func (*InstallerBase) RunCmdGetSuccessPassThrough ¶ added in v1.9.4
func (i *InstallerBase) RunCmdGetSuccessPassThrough(command string, args ...string) (bool, error)
RunCmdGetSuccessPassThrough runs a command, passes through its output, and returns true if it succeeds.
func (*InstallerBase) RunCmdPassThrough ¶ added in v1.8.0
func (i *InstallerBase) RunCmdPassThrough(command string, args ...string) error
RunCmdPassThrough runs a command and passes through its output.
func (*InstallerBase) RunCustomInstallCheck ¶ added in v1.8.0
func (i *InstallerBase) RunCustomInstallCheck() (bool, error)
RunCustomInstallCheck runs a custom command to check if the software is installed.
func (*InstallerBase) RunCustomUpdateCheck ¶ added in v1.8.0
func (i *InstallerBase) RunCustomUpdateCheck() (bool, error)
RunCustomUpdateCheck runs a custom command to check for updates.
type ManifestInstaller ¶ added in v1.4.0
type ManifestInstaller struct {
InstallerBase
// Config is the main application configuration.
Config *appconfig.AppConfig
// Info is the installer data for this manifest installer.
Info *appconfig.InstallerData
// ManifestConfig is the configuration loaded from the manifest file.
ManifestConfig *appconfig.AppConfig
}
ManifestInstaller is an installer that installs software based on another sofmani manifest file.
func NewManifestInstaller ¶ added in v1.4.0
func NewManifestInstaller(cfg *appconfig.AppConfig, installer *appconfig.InstallerData) *ManifestInstaller
func (*ManifestInstaller) CheckIsInstalled ¶ added in v1.4.0
func (i *ManifestInstaller) CheckIsInstalled() (bool, error)
CheckIsInstalled implements IInstaller.
func (*ManifestInstaller) CheckNeedsUpdate ¶ added in v1.4.0
func (i *ManifestInstaller) CheckNeedsUpdate() (bool, error)
CheckNeedsUpdate implements IInstaller.
func (*ManifestInstaller) FetchManifest ¶ added in v1.4.0
func (i *ManifestInstaller) FetchManifest() error
FetchManifest fetches and parses the manifest file. It handles both local and Git sources.
func (*ManifestInstaller) GetData ¶ added in v1.5.0
func (i *ManifestInstaller) GetData() *appconfig.InstallerData
GetData implements IInstaller.
func (*ManifestInstaller) GetOpts ¶ added in v1.4.0
func (i *ManifestInstaller) GetOpts() *ManifestOpts
GetOpts returns the parsed options for the ManifestInstaller.
func (*ManifestInstaller) Install ¶ added in v1.4.0
func (i *ManifestInstaller) Install() error
Install implements IInstaller.
func (*ManifestInstaller) Update ¶ added in v1.4.0
func (i *ManifestInstaller) Update() error
Update implements IInstaller.
func (*ManifestInstaller) Validate ¶ added in v1.9.0
func (i *ManifestInstaller) Validate() []ValidationError
Validate validates the installer configuration.
type ManifestOpts ¶ added in v1.4.0
type ManifestOpts struct {
// Source is the source of the manifest file. It can be a local path or a Git URL.
Source *string
// Path is the path to the manifest file within the source (if applicable, e.g., in a Git repository).
Path *string
// Ref is the Git reference (branch, tag, or commit) to use if the source is a Git URL.
Ref *string
}
ManifestOpts represents options for the ManifestInstaller.
type MockInstaller ¶ added in v1.10.0
type MockInstaller struct {
// contains filtered or unexported fields
}
MockInstaller is a mock implementation of the IInstaller interface for testing.
func (*MockInstaller) CheckIsInstalled ¶ added in v1.10.0
func (m *MockInstaller) CheckIsInstalled() (bool, error)
CheckIsInstalled simulates checking if the software is installed.
func (*MockInstaller) CheckNeedsUpdate ¶ added in v1.10.0
func (m *MockInstaller) CheckNeedsUpdate() (bool, error)
CheckNeedsUpdate simulates checking if an update is needed.
func (*MockInstaller) GetData ¶ added in v1.10.0
func (m *MockInstaller) GetData() *appconfig.InstallerData
GetData returns the installer data for the mock installer.
func (*MockInstaller) Install ¶ added in v1.10.0
func (m *MockInstaller) Install() error
Install simulates installing the software.
func (*MockInstaller) Update ¶ added in v1.10.0
func (m *MockInstaller) Update() error
Update simulates updating the software.
func (*MockInstaller) Validate ¶ added in v1.10.0
func (m *MockInstaller) Validate() []ValidationError
Validate simulates validating the installer configuration.
type NpmInstaller ¶ added in v1.1.0
type NpmInstaller struct {
InstallerBase
// Config is the application configuration.
Config *appconfig.AppConfig
// PackageManager is the package manager to use (npm, pnpm, or yarn).
PackageManager NpmPackageManager
// Info is the installer data.
Info *appconfig.InstallerData
}
NpmInstaller is an installer for npm, pnpm, and yarn packages.
func NewNpmInstaller ¶ added in v1.1.0
func NewNpmInstaller(cfg *appconfig.AppConfig, installer *appconfig.InstallerData) *NpmInstaller
NewNpmInstaller creates a new NpmInstaller.
func (*NpmInstaller) CheckIsInstalled ¶ added in v1.1.0
func (i *NpmInstaller) CheckIsInstalled() (bool, error)
CheckIsInstalled implements IInstaller.
func (*NpmInstaller) CheckNeedsUpdate ¶ added in v1.1.0
func (i *NpmInstaller) CheckNeedsUpdate() (bool, error)
CheckNeedsUpdate implements IInstaller.
func (*NpmInstaller) GetBinName ¶ added in v1.1.0
func (i *NpmInstaller) GetBinName() string
GetBinName returns the binary name for the installer. It uses the BinName from the installer data if provided, otherwise it uses the installer name.
func (*NpmInstaller) GetData ¶ added in v1.5.0
func (i *NpmInstaller) GetData() *appconfig.InstallerData
GetData implements IInstaller.
func (*NpmInstaller) GetOpts ¶ added in v1.1.0
func (i *NpmInstaller) GetOpts() *NpmOpts
GetOpts returns the parsed options for the NpmInstaller.
func (*NpmInstaller) Install ¶ added in v1.1.0
func (i *NpmInstaller) Install() error
Install implements IInstaller.
func (*NpmInstaller) Update ¶ added in v1.1.0
func (i *NpmInstaller) Update() error
Update implements IInstaller.
func (*NpmInstaller) Validate ¶ added in v1.9.0
func (i *NpmInstaller) Validate() []ValidationError
Validate validates the installer configuration.
type NpmOpts ¶ added in v1.1.0
type NpmOpts struct {
}
NpmOpts represents options for the NpmInstaller.
type NpmPackageManager ¶ added in v1.10.0
type NpmPackageManager string
NpmPackageManager represents a Node.js package manager type. This type is also defined in apt_installer.go. Consider refactoring to a common location if appropriate.
const ( PackageManagerNpm NpmPackageManager = "npm" // PackageManagerNpm represents the npm package manager. PackageManagerYarn NpmPackageManager = "yarn" // PackageManagerYarn represents the yarn package manager. PackageManagerPnpm NpmPackageManager = "pnpm" // PackageManagerPnpm represents the pnpm package manager. )
Constants for supported Node.js package managers.
type PipxInstaller ¶ added in v1.7.0
type PipxInstaller struct {
InstallerBase
// Config is the application configuration.
Config *appconfig.AppConfig
// Info is the installer data.
Info *appconfig.InstallerData
}
PipxInstaller is an installer for pipx packages.
func NewPipxInstaller ¶ added in v1.7.0
func NewPipxInstaller(cfg *appconfig.AppConfig, installer *appconfig.InstallerData) *PipxInstaller
NewPipxInstaller creates a new PipxInstaller.
func (*PipxInstaller) CheckIsInstalled ¶ added in v1.7.0
func (i *PipxInstaller) CheckIsInstalled() (bool, error)
CheckIsInstalled implements IInstaller.
func (*PipxInstaller) CheckNeedsUpdate ¶ added in v1.7.0
func (i *PipxInstaller) CheckNeedsUpdate() (bool, error)
CheckNeedsUpdate implements IInstaller.
func (*PipxInstaller) GetBinName ¶ added in v1.7.0
func (i *PipxInstaller) GetBinName() string
GetBinName returns the binary name for the installer. It uses the BinName from the installer data if provided, otherwise it uses the installer name.
func (*PipxInstaller) GetData ¶ added in v1.7.0
func (i *PipxInstaller) GetData() *appconfig.InstallerData
GetData implements IInstaller.
func (*PipxInstaller) GetOpts ¶ added in v1.7.0
func (i *PipxInstaller) GetOpts() *PipxOpts
GetOpts returns the parsed options for the PipxInstaller.
func (*PipxInstaller) Install ¶ added in v1.7.0
func (i *PipxInstaller) Install() error
Install implements IInstaller.
func (*PipxInstaller) Update ¶ added in v1.7.0
func (i *PipxInstaller) Update() error
Update implements IInstaller.
func (*PipxInstaller) Validate ¶ added in v1.9.0
func (i *PipxInstaller) Validate() []ValidationError
Validate validates the installer configuration.
type PipxOpts ¶ added in v1.7.0
type PipxOpts struct {
}
PipxOpts represents options for the PipxInstaller.
type RsyncInstaller ¶
type RsyncInstaller struct {
InstallerBase
// Config is the application configuration.
Config *appconfig.AppConfig
// Info is the installer data.
Info *appconfig.InstallerData
}
RsyncInstaller is an installer that uses rsync to copy files.
func NewRsyncInstaller ¶
func NewRsyncInstaller(cfg *appconfig.AppConfig, installer *appconfig.InstallerData) *RsyncInstaller
NewRsyncInstaller creates a new RsyncInstaller.
func (*RsyncInstaller) CheckIsInstalled ¶
func (i *RsyncInstaller) CheckIsInstalled() (bool, error)
CheckIsInstalled implements IInstaller.
func (*RsyncInstaller) CheckNeedsUpdate ¶
func (i *RsyncInstaller) CheckNeedsUpdate() (bool, error)
CheckNeedsUpdate implements IInstaller.
func (*RsyncInstaller) GetBinName ¶
func (i *RsyncInstaller) GetBinName() string
GetBinName returns the binary name for the installer. For rsync, this is typically not applicable as it's a file transfer, not a binary installation. It defaults to the installer name.
func (*RsyncInstaller) GetData ¶ added in v1.5.0
func (i *RsyncInstaller) GetData() *appconfig.InstallerData
GetData implements IInstaller.
func (*RsyncInstaller) GetOpts ¶
func (i *RsyncInstaller) GetOpts() *RsyncOpts
GetOpts returns the parsed options for the RsyncInstaller.
func (*RsyncInstaller) Install ¶
func (i *RsyncInstaller) Install() error
Install implements IInstaller.
func (*RsyncInstaller) Update ¶
func (i *RsyncInstaller) Update() error
Update implements IInstaller.
func (*RsyncInstaller) Validate ¶ added in v1.9.0
func (i *RsyncInstaller) Validate() []ValidationError
Validate validates the installer configuration.
type RsyncOpts ¶
type RsyncOpts struct {
// Source is the source directory or file.
Source *string
// Destination is the destination directory or file.
Destination *string
// Flags is a string of flags to pass to the rsync command.
Flags *string
}
RsyncOpts represents options for the RsyncInstaller.
type ShellInstaller ¶
type ShellInstaller struct {
InstallerBase
// Config is the application configuration.
Config *appconfig.AppConfig
// Info is the installer data.
Info *appconfig.InstallerData
}
ShellInstaller is an installer that runs shell commands.
func NewShellInstaller ¶
func NewShellInstaller(cfg *appconfig.AppConfig, installer *appconfig.InstallerData) *ShellInstaller
NewShellInstaller creates a new ShellInstaller.
func (*ShellInstaller) CheckIsInstalled ¶
func (i *ShellInstaller) CheckIsInstalled() (bool, error)
CheckIsInstalled implements IInstaller.
func (*ShellInstaller) CheckNeedsUpdate ¶
func (i *ShellInstaller) CheckNeedsUpdate() (bool, error)
CheckNeedsUpdate implements IInstaller.
func (*ShellInstaller) GetBinName ¶
func (i *ShellInstaller) GetBinName() string
GetBinName returns the binary name for the installer. It uses the BinName from the installer data if provided, otherwise it uses the installer name.
func (*ShellInstaller) GetData ¶ added in v1.5.0
func (i *ShellInstaller) GetData() *appconfig.InstallerData
GetData implements IInstaller.
func (*ShellInstaller) GetOpts ¶
func (i *ShellInstaller) GetOpts() *ShellOpts
GetOpts returns the parsed options for the ShellInstaller.
func (*ShellInstaller) Install ¶
func (i *ShellInstaller) Install() error
Install implements IInstaller.
func (*ShellInstaller) Update ¶
func (i *ShellInstaller) Update() error
Update implements IInstaller.
func (*ShellInstaller) Validate ¶ added in v1.9.0
func (i *ShellInstaller) Validate() []ValidationError
Validate validates the installer configuration.
type ShellOpts ¶
type ShellOpts struct {
// Command is the shell command to run for installation.
Command *string
// UpdateCommand is the shell command to run for updating. If not provided, the install command is used.
UpdateCommand *string
}
ShellOpts represents options for the ShellInstaller.
type ValidationError ¶ added in v1.9.0
type ValidationError struct {
// FieldName is the name of the field that failed validation.
FieldName string
// Message is a description of the validation error.
Message string
// InstallerName is the name of the installer where the validation error occurred.
InstallerName string
}
ValidationError represents a validation error for an installer configuration.
func (ValidationError) Error ¶ added in v1.9.0
func (v ValidationError) Error() string
Error returns a string representation of the validation error.