system

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SupportedPodmanVersion          = "4.9.3"
	SupportedComposeProviderVersion = "1.0.6"
)

Variables

This section is empty.

Functions

func AnyContainerExists

func AnyContainerExists(ctx context.Context, containerNames []string) (bool, error)

func ClipboardAvailable

func ClipboardAvailable() bool

func CommandExists

func CommandExists(name string) bool

func CopyToClipboard

func CopyToClipboard(ctx context.Context, runner Runner, value string) error

func DetectPackageManager

func DetectPackageManager() string

func EnableCockpit

func EnableCockpit(ctx context.Context, runner Runner) error

func FormatPackageManagerRecommendation

func FormatPackageManagerRecommendation(rec PackageManagerRecommendation) string

func InstallPackages

func InstallPackages(ctx context.Context, runner Runner, packageManager string, requirements []Requirement) ([]string, error)

func OpenCommandName

func OpenCommandName() string

func OpenURL

func OpenURL(ctx context.Context, runner Runner, target string) error

func PackageManagerCommand

func PackageManagerCommand(packageManager string) string

func PackageManagerSupported

func PackageManagerSupported(packageManager string) bool

func PodmanComposeAvailable

func PodmanComposeAvailable(ctx context.Context) bool

func PodmanComposeVersion

func PodmanComposeVersion(ctx context.Context) (string, error)

func PodmanVersion

func PodmanVersion(ctx context.Context) (string, error)

func PortInUse

func PortInUse(port int) (bool, error)

func PortListening

func PortListening(port int) bool

func PreparePodmanMachine

func PreparePodmanMachine(ctx context.Context, runner Runner) error

func RunExternalCommand

func RunExternalCommand(ctx context.Context, runner Runner, dir string, commandArgs []string) error

func VersionAtLeast

func VersionAtLeast(version, minimum string) bool

func WaitForPort

func WaitForPort(ctx context.Context, port int, interval time.Duration) error

Types

type CaptureFunc

type CaptureFunc func(context.Context, string, string, ...string) (CommandResult, error)

type CockpitState

type CockpitState struct {
	Installed bool
	Active    bool
	State     string
}

func CockpitStatus

func CockpitStatus(ctx context.Context) CockpitState

type CommandResult

type CommandResult struct {
	Stdout   string
	Stderr   string
	ExitCode int
}

func CaptureResult

func CaptureResult(ctx context.Context, dir, name string, args ...string) (CommandResult, error)

func CaptureResultWithEnv

func CaptureResultWithEnv(ctx context.Context, dir string, env []string, name string, args ...string) (CommandResult, error)

type Container

type Container struct {
	ID        string          `json:"Id"`
	Image     string          `json:"Image"`
	Names     []string        `json:"Names"`
	Status    string          `json:"Status"`
	State     string          `json:"State"`
	Ports     []ContainerPort `json:"Ports"`
	CreatedAt string          `json:"CreatedAt"`
}

func FilterContainersByName

func FilterContainersByName(containers []Container, names []string) []Container

func ListContainers

func ListContainers(ctx context.Context, capture CaptureFunc) ([]Container, error)

type ContainerPort

type ContainerPort struct {
	HostPort      int    `json:"host_port"`
	ContainerPort int    `json:"container_port"`
	Protocol      string `json:"protocol"`
}

type InstallPlan

type InstallPlan struct {
	Packages    []string
	Unsupported []Requirement
}

func ResolveInstallPlan

func ResolveInstallPlan(packageManager string, requirements []Requirement) (InstallPlan, error)

type OvercommitStatus

type OvercommitStatus struct {
	Supported bool
	Value     int
}

func RedisOvercommitStatus

func RedisOvercommitStatus(ctx context.Context) (OvercommitStatus, error)

type PackageManagerChoice

type PackageManagerChoice struct {
	Name    string
	Command string
	Notice  string
}

func ResolvePackageManagerChoice

func ResolvePackageManagerChoice(configured string, platform Platform, commandExists func(string) bool) (PackageManagerChoice, error)

type PackageManagerRecommendation

type PackageManagerRecommendation struct {
	Name      string
	Command   string
	Available bool
	Reason    string
}

func CurrentPackageManagerRecommendation

func CurrentPackageManagerRecommendation() PackageManagerRecommendation

func RecommendPackageManager

func RecommendPackageManager(platform Platform, commandExists func(string) bool) PackageManagerRecommendation

type Platform

type Platform struct {
	GOOS            string
	DistroID        string
	DistroLike      []string
	VersionID       string
	VersionCodename string
	PackageManager  string
	ServiceManager  ServiceManager
}

func CurrentPlatform

func CurrentPlatform() Platform

func (Platform) SupportsBuildah

func (p Platform) SupportsBuildah() bool

func (Platform) SupportsCockpit

func (p Platform) SupportsCockpit() bool

func (Platform) SupportsCockpitAutoEnable

func (p Platform) SupportsCockpitAutoEnable() bool

func (Platform) SupportsCockpitAutoInstall

func (p Platform) SupportsCockpitAutoInstall() bool

func (Platform) SupportsSSCheck

func (p Platform) SupportsSSCheck() bool

func (Platform) UsesPodmanMachine

func (p Platform) UsesPodmanMachine() bool

type PodmanMachineState

type PodmanMachineState struct {
	Supported   bool
	Initialized bool
	Running     bool
	Name        string
	State       string
}

func PodmanMachineStatus

func PodmanMachineStatus(ctx context.Context) PodmanMachineState

type Requirement

type Requirement string
const (
	RequirementPodman          Requirement = "podman"
	RequirementComposeProvider Requirement = "podman compose provider"
	RequirementBuildah         Requirement = "buildah"
	RequirementSkopeo          Requirement = "skopeo"
	RequirementCockpit         Requirement = "cockpit"
)

type Runner

type Runner struct {
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
	Env    []string
}

func (Runner) Capture

func (r Runner) Capture(ctx context.Context, dir, name string, args ...string) (string, error)

func (Runner) Run

func (r Runner) Run(ctx context.Context, dir, name string, args ...string) error

type ServiceManager

type ServiceManager string
const (
	ServiceManagerNone    ServiceManager = "none"
	ServiceManagerOpenRC  ServiceManager = "openrc"
	ServiceManagerSystemd ServiceManager = "systemd"
)

Jump to

Keyboard shortcuts

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