Documentation
¶
Overview ¶
Package version provides version management functionality for LacyLights. It interfaces with the update-repos.sh script to check and update component versions.
Index ¶
- Constants
- func ResetBuildInfoForTesting()
- func SetBuildInfo(version, gitCommit, buildTimeVal string)
- func SetTestInstalledRepos(repos []string)
- type BuildInfo
- type RepositoryVersion
- type Service
- func (s *Service) GetAvailableVersions(repository string) ([]string, error)
- func (s *Service) GetSystemVersions() (*SystemVersionInfo, error)
- func (s *Service) IsSupported() bool
- func (s *Service) UpdateAllRepositories() ([]*UpdateResult, error)
- func (s *Service) UpdateRepository(repository string, version *string) (*UpdateResult, error)
- type SystemVersionInfo
- type UpdateResult
Constants ¶
const ( // UpdateScriptPath is the path to the update-repos.sh script on the Pi UpdateScriptPath = "/opt/lacylights/scripts/update-repos.sh" // SelfUpdateScriptPath is the path to the self-update wrapper for updating lacylights-go itself SelfUpdateScriptPath = "/opt/lacylights/scripts/self-update.sh" // RunUpdateScriptPath is the path to the secure update runner script // This script validates inputs before running updates, preventing command injection RunUpdateScriptPath = "/opt/lacylights/scripts/run-update.sh" // UpdateLogPath is the path to the update log file UpdateLogPath = "/opt/lacylights/logs/update.log" )
Variables ¶
This section is empty.
Functions ¶
func ResetBuildInfoForTesting ¶ added in v0.2.12
func ResetBuildInfoForTesting()
ResetBuildInfoForTesting resets the build info to defaults for testing purposes. This function is thread-safe and can be called from concurrent tests. WARNING: This should only be called from test code.
func SetBuildInfo ¶ added in v0.2.12
func SetBuildInfo(version, gitCommit, buildTimeVal string)
SetBuildInfo sets the build information (called from main package at startup). Uses sync.Once to ensure initialization happens exactly once, and RWMutex for thread-safe access. Empty string values are ignored to preserve default values during development builds.
func SetTestInstalledRepos ¶ added in v0.2.26
func SetTestInstalledRepos(repos []string)
SetTestInstalledRepos allows tests to override which repositories are "installed". Pass nil to reset to default behavior (check actual files). This function is thread-safe and can be called from concurrent tests. WARNING: This should only be called from test code.
Types ¶
type BuildInfo ¶ added in v0.2.12
BuildInfo contains server build information for version verification
func GetBuildInfo ¶ added in v0.2.12
func GetBuildInfo() BuildInfo
GetBuildInfo returns the current build information. Thread-safe for concurrent access.
type RepositoryVersion ¶
type RepositoryVersion struct {
Repository string
Installed string
Latest string
UpdateAvailable bool
}
RepositoryVersion contains version information for a single repository
type Service ¶
type Service struct{}
Service provides version management functionality
func (*Service) GetAvailableVersions ¶
GetAvailableVersions returns available versions for a specific repository
func (*Service) GetSystemVersions ¶
func (s *Service) GetSystemVersions() (*SystemVersionInfo, error)
GetSystemVersions returns version information for all repositories
func (*Service) IsSupported ¶
IsSupported checks if version management is available on this system
func (*Service) UpdateAllRepositories ¶
func (s *Service) UpdateAllRepositories() ([]*UpdateResult, error)
UpdateAllRepositories updates all repositories to their latest versions
func (*Service) UpdateRepository ¶
func (s *Service) UpdateRepository(repository string, version *string) (*UpdateResult, error)
UpdateRepository updates a specific repository to a specific version
type SystemVersionInfo ¶
type SystemVersionInfo struct {
Repositories []*RepositoryVersion
LastChecked string
VersionManagementSupported bool
}
SystemVersionInfo contains version information for all repositories