updates

package
v1.6.28 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: GPL-3.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ModuleName is the name of the update module
	// and can be used when declaring module dependencies.
	ModuleName = "updates"

	// VersionUpdateEvent is emitted every time a new
	// version of a monitored resource is selected.
	// During module initialization VersionUpdateEvent
	// is also emitted.
	VersionUpdateEvent = "active version update"

	// ResourceUpdateEvent is emitted every time the
	// updater successfully performed a resource update.
	// ResourceUpdateEvent is emitted even if no new
	// versions are available. Subscribers are expected
	// to check if new versions of their resources are
	// available by checking File.UpgradeAvailable().
	ResourceUpdateEvent = "resource update"
)

Variables

View Source
var (

	// UserAgent is an HTTP User-Agent that is used to add
	// more context to requests made by the registry when
	// fetching resources from the update server.
	UserAgent = fmt.Sprintf("Portmaster (%s %s)", runtime.GOOS, runtime.GOARCH)

	// DefaultUpdateURLs defines the default base URLs of the update server.
	DefaultUpdateURLs = []string{
		"https://updates.safing.io",
	}

	// DisableSoftwareAutoUpdate specifies whether software updates should be disabled.
	// This is used on Android, as it will never require binary updates.
	DisableSoftwareAutoUpdate = false
)
View Source
var (

	// ErrRequiresManualUpgrade is returned when a system integration file requires a manual upgrade.
	ErrRequiresManualUpgrade = errors.New("requires a manual upgrade")
)
View Source
var (
	// RebootOnRestart defines whether the whole system, not just the service,
	// should be restarted automatically when triggering a restart internally.
	RebootOnRestart bool
)

Functions

func AbortRestart

func AbortRestart()

AbortRestart aborts a (delayed) restart.

func AddToDebugInfo

func AddToDebugInfo(di *debug.Info)

AddToDebugInfo adds the update system status to the given debug.Info.

func CopyFile

func CopyFile(srcPath, dstPath string) error

CopyFile atomically copies a file using the update registry's tmp dir.

func DelayedRestart

func DelayedRestart(delay time.Duration)

DelayedRestart triggers a restart of the application by shutting down the module system gracefully and returning with RestartExitCode. The restart may be further delayed by up to 10 minutes by the internal task scheduling system. This only works if the process is managed by portmaster-start.

func DisableUpdateSchedule

func DisableUpdateSchedule() error

DisableUpdateSchedule disables the update schedule. If called, updates are only checked when TriggerUpdate() is called.

func GetFile

func GetFile(identifier string) (*updater.File, error)

GetFile returns the latest generic file identified by the given identifier.

func GetPlatformFile

func GetPlatformFile(identifier string) (*updater.File, error)

GetPlatformFile returns the latest platform specific file identified by the given identifier.

func GetPlatformVersion

func GetPlatformVersion(identifier string) (*updater.ResourceVersion, error)

GetPlatformVersion returns the selected platform specific version of the given identifier. The returned resource version may not be modified.

func GetVersion

func GetVersion(identifier string) (*updater.ResourceVersion, error)

GetVersion returns the selected generic version of the given identifier. The returned resource version may not be modified.

func GetVersionWithFullID

func GetVersionWithFullID(identifier string) (*updater.ResourceVersion, error)

GetVersionWithFullID returns the selected generic version of the given full identifier. The returned resource version may not be modified.

func IsRestarting

func IsRestarting() bool

IsRestarting returns whether a restart has been triggered.

func RestartIsPending

func RestartIsPending() (pending bool, restartAt time.Time)

RestartIsPending returns whether a restart is pending.

func RestartNow

func RestartNow()

RestartNow immediately executes a restart. This only works if the process is managed by portmaster-start.

func RootPath

func RootPath() string

RootPath returns the root path used for storing updates.

func TriggerRestartIfPending

func TriggerRestartIfPending()

TriggerRestartIfPending triggers an automatic restart, if one is pending. This can be used to prepone a scheduled restart if the conditions are preferable.

func TriggerUpdate

func TriggerUpdate(forceIndexCheck, downloadAll bool) error

TriggerUpdate queues the update task to execute ASAP.

Types

type RegistryStateExport

type RegistryStateExport struct {
	record.Base
	*updater.RegistryState
}

RegistryStateExport is a wrapper to export the registry state.

type SimpleVersions

type SimpleVersions struct {
	record.Base
	sync.Mutex

	Build     *info.Info
	Resources map[string]*SimplifiedResourceVersion
	Channel   string
}

SimpleVersions holds simplified update versions and status information.

func GetSimpleVersions

func GetSimpleVersions() *SimpleVersions

GetSimpleVersions returns the simplified update versions and status information.

type SimplifiedResourceVersion

type SimplifiedResourceVersion struct {
	Version string
}

SimplifiedResourceVersion holds version information about one resource.

type UpdateStateExport

type UpdateStateExport struct {
	record.Base
	sync.Mutex

	*updater.UpdateState
}

UpdateStateExport is a wrapper to export the updates state.

func GetStateExport

func GetStateExport() *UpdateStateExport

GetStateExport gets the update state from the registry and returns it in an exportable struct.

func LoadStateExport

func LoadStateExport() (*UpdateStateExport, error)

LoadStateExport loads the exported update state from the database.

type Updates added in v1.6.19

type Updates struct {
	EventResourcesUpdated *mgr.EventMgr[struct{}]
	EventVersionsUpdated  *mgr.EventMgr[struct{}]
	// contains filtered or unexported fields
}

Updates provides access to released artifacts.

func New added in v1.6.19

func New(instance instance) (*Updates, error)

New returns a new UI module.

func (*Updates) Manager added in v1.6.19

func (u *Updates) Manager() *mgr.Manager

Manager returns the module manager.

func (*Updates) Start added in v1.6.19

func (u *Updates) Start() error

Start starts the module.

func (*Updates) States added in v1.6.19

func (u *Updates) States() *mgr.StateMgr

States returns the state manager.

func (*Updates) Stop added in v1.6.19

func (u *Updates) Stop() error

Stop stops the module.

type Versions

type Versions struct {
	record.Base
	sync.Mutex

	Core      *info.Info
	Resources map[string]*updater.Resource
	Channel   string
	Beta      bool
	Staging   bool
}

Versions holds update versions and status information.

func GetVersions

func GetVersions() *Versions

GetVersions returns the update versions and status information. Resources must be locked when accessed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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