updater

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AptManager

type AptManager struct{}

AptManager represents APT package manager.

func (*AptManager) IsAvailable

func (a *AptManager) IsAvailable() bool

func (*AptManager) Name

func (a *AptManager) Name() string

func (*AptManager) UpgradeCommand

func (a *AptManager) UpgradeCommand() []string

func (*AptManager) Validate

func (a *AptManager) Validate() error

type BrewManager

type BrewManager struct{}

BrewManager represents Homebrew package manager.

func (*BrewManager) IsAvailable

func (b *BrewManager) IsAvailable() bool

func (*BrewManager) Name

func (b *BrewManager) Name() string

func (*BrewManager) UpgradeCommand

func (b *BrewManager) UpgradeCommand() []string

func (*BrewManager) Validate

func (b *BrewManager) Validate() error

type CheckResult

type CheckResult struct {
	UpdateAvailable bool
	LatestVersion   string
	ReleaseURL      string
	SkipCheck       bool
}

CheckResult contains the result of an update check.

type CheckState

type CheckState struct {
	LastCheck time.Time `json:"last_check"`
	LastSkip  time.Time `json:"last_skip"`
}

CheckState stores information about the last update check.

type DnfManager

type DnfManager struct{}

DnfManager represents DNF package manager.

func (*DnfManager) IsAvailable

func (d *DnfManager) IsAvailable() bool

func (*DnfManager) Name

func (d *DnfManager) Name() string

func (*DnfManager) UpgradeCommand

func (d *DnfManager) UpgradeCommand() []string

func (*DnfManager) Validate

func (d *DnfManager) Validate() error

type GitHubRelease

type GitHubRelease struct {
	TagName     string    `json:"tag_name"`
	Name        string    `json:"name"`
	PreRelease  bool      `json:"prerelease"`
	Draft       bool      `json:"draft"`
	PublishedAt time.Time `json:"published_at"`
	HTMLURL     string    `json:"html_url"`
	Body        string    `json:"body"`
}

GitHubRelease represents a GitHub release from the API.

type ManualManager

type ManualManager struct{}

ManualManager represents manual installation (download from GitHub).

func (*ManualManager) IsAvailable

func (m *ManualManager) IsAvailable() bool

func (*ManualManager) Name

func (m *ManualManager) Name() string

func (*ManualManager) UpgradeCommand

func (m *ManualManager) UpgradeCommand() []string

func (*ManualManager) Validate

func (m *ManualManager) Validate() error

type PackageManager

type PackageManager interface {
	// Name returns the package manager name
	Name() string
	// IsAvailable checks if the package manager is available on the system
	IsAvailable() bool
	// UpgradeCommand returns the command to upgrade dot
	UpgradeCommand() []string
	// Validate validates the package manager and its upgrade command for security
	Validate() error
}

PackageManager represents a system package manager.

func DetectPackageManager

func DetectPackageManager() PackageManager

DetectPackageManager attempts to detect the system package manager.

func GetPackageManager

func GetPackageManager(name string) (PackageManager, error)

GetPackageManager returns the appropriate package manager based on the name.

func ResolvePackageManager

func ResolvePackageManager(configuredManager string) (PackageManager, error)

ResolvePackageManager resolves the package manager from config. If "auto" is specified, it detects the system package manager.

type PacmanManager

type PacmanManager struct{}

PacmanManager represents Pacman package manager.

func (*PacmanManager) IsAvailable

func (p *PacmanManager) IsAvailable() bool

func (*PacmanManager) Name

func (p *PacmanManager) Name() string

func (*PacmanManager) UpgradeCommand

func (p *PacmanManager) UpgradeCommand() []string

func (*PacmanManager) Validate

func (p *PacmanManager) Validate() error

type StartupChecker

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

StartupChecker performs update checks at application startup.

func NewStartupChecker

func NewStartupChecker(currentVersion string, cfg *config.ExtendedConfig, configDir string, output io.Writer) *StartupChecker

NewStartupChecker creates a new startup checker.

func (*StartupChecker) Check

func (sc *StartupChecker) Check() (*CheckResult, error)

Check performs a startup update check if configured and due.

func (*StartupChecker) ShowNotification

func (sc *StartupChecker) ShowNotification(result *CheckResult)

ShowNotification displays an update notification to the user.

type StateManager

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

StateManager manages the update check state file.

func NewStateManager

func NewStateManager(configDir string) *StateManager

NewStateManager creates a new state manager.

func (*StateManager) Load

func (sm *StateManager) Load() (*CheckState, error)

Load loads the check state from disk.

func (*StateManager) RecordCheck

func (sm *StateManager) RecordCheck() error

RecordCheck records that a check was performed.

func (*StateManager) RecordSkip

func (sm *StateManager) RecordSkip() error

RecordSkip records that the user skipped an upgrade prompt.

func (*StateManager) Save

func (sm *StateManager) Save(state *CheckState) error

Save saves the check state to disk atomically with restrictive permissions.

func (*StateManager) ShouldCheck

func (sm *StateManager) ShouldCheck(frequency time.Duration) (bool, error)

ShouldCheck determines if enough time has passed since the last check.

type Version

type Version struct {
	Major      int
	Minor      int
	Patch      int
	PreRelease string
	Raw        string
}

Version represents a semantic version.

func ParseVersion

func ParseVersion(versionStr string) (*Version, error)

ParseVersion parses a version string into a Version struct.

func (*Version) IsNewerThan

func (v *Version) IsNewerThan(other *Version) bool

IsNewerThan returns true if v is newer than other.

func (*Version) String

func (v *Version) String() string

String returns the version as a string.

type VersionChecker

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

VersionChecker checks for new versions from GitHub releases.

func NewVersionChecker

func NewVersionChecker(repository string) *VersionChecker

NewVersionChecker creates a new version checker with default configuration.

func NewVersionCheckerWithConfig

func NewVersionCheckerWithConfig(repository string, networkCfg *config.NetworkConfig) *VersionChecker

NewVersionCheckerWithConfig creates a new version checker with explicit network configuration.

func (*VersionChecker) CheckForUpdate

func (vc *VersionChecker) CheckForUpdate(currentVersion string, includePrerelease bool) (newVersion *GitHubRelease, hasUpdate bool, err error)

CheckForUpdate checks if there's a newer version available.

func (*VersionChecker) GetLatestVersion

func (vc *VersionChecker) GetLatestVersion(includePrerelease bool) (*GitHubRelease, error)

GetLatestVersion fetches the latest release from GitHub.

type YumManager

type YumManager struct{}

YumManager represents YUM package manager.

func (*YumManager) IsAvailable

func (y *YumManager) IsAvailable() bool

func (*YumManager) Name

func (y *YumManager) Name() string

func (*YumManager) UpgradeCommand

func (y *YumManager) UpgradeCommand() []string

func (*YumManager) Validate

func (y *YumManager) Validate() error

type ZypperManager

type ZypperManager struct{}

ZypperManager represents Zypper package manager.

func (*ZypperManager) IsAvailable

func (z *ZypperManager) IsAvailable() bool

func (*ZypperManager) Name

func (z *ZypperManager) Name() string

func (*ZypperManager) UpgradeCommand

func (z *ZypperManager) UpgradeCommand() []string

func (*ZypperManager) Validate

func (z *ZypperManager) Validate() error

Jump to

Keyboard shortcuts

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