Documentation
¶
Overview ¶
Package update provides self-update functionality for engram.
Index ¶
Constants ¶
View Source
const ( GitHubRepo = "thebtf/engram" ReleasesAPI = "https://api.github.com/repos/" + GitHubRepo + "/releases/latest" CheckInterval = 24 * time.Hour MaxExtractedSize = 250 * 1024 * 1024 // 250MB max per extracted file RestartDelay = 500 * time.Millisecond )
View Source
const InstallScriptURL = "https://raw.githubusercontent.com/" + GitHubRepo + "/main/scripts/install.sh"
InstallScriptURL is the URL to the remote installation script.
Variables ¶
This section is empty.
Functions ¶
func GetManualUpdateCommand ¶
GetManualUpdateCommand returns the curl command for manual update. If version is empty, it installs the latest version.
Types ¶
type Asset ¶
type Asset struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
Size int64 `json:"size"`
}
Asset represents a release asset.
type Release ¶
type Release struct {
PublishedAt time.Time `json:"published_at"`
TagName string `json:"tag_name"`
Name string `json:"name"`
Body string `json:"body"`
Assets []Asset `json:"assets"`
}
Release represents a GitHub release.
type UpdateInfo ¶
type UpdateInfo struct {
PublishedAt time.Time `json:"published_at,omitempty"`
CurrentVersion string `json:"current_version"`
LatestVersion string `json:"latest_version"`
ReleaseNotes string `json:"release_notes,omitempty"`
DownloadURL string `json:"download_url,omitempty"`
ChecksumsURL string `json:"checksums_url,omitempty"`
BundleURL string `json:"bundle_url,omitempty"`
ManualUpdateCommand string `json:"manual_update_command,omitempty"`
Available bool `json:"available"`
}
UpdateInfo contains information about an available update.
type UpdateStatus ¶
type UpdateStatus struct {
State string `json:"state"`
Message string `json:"message"`
Error string `json:"error,omitempty"`
ManualUpdateCommand string `json:"manual_update_command,omitempty"`
Progress float64 `json:"progress"`
}
UpdateStatus represents the current update status.
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
Updater handles self-updates.
func (*Updater) ApplyUpdate ¶
func (u *Updater) ApplyUpdate(ctx context.Context, info *UpdateInfo) error
ApplyUpdate downloads and applies the update.
func (*Updater) CheckForUpdate ¶
func (u *Updater) CheckForUpdate(ctx context.Context) (*UpdateInfo, error)
CheckForUpdate checks if a new version is available.
func (*Updater) GetStatus ¶
func (u *Updater) GetStatus() UpdateStatus
GetStatus returns the current update status.
Click to show internal directories.
Click to hide internal directories.