unattended

package module
v0.0.0-...-57ca260 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2019 License: Apache-2.0 Imports: 21 Imported by: 1

README

go-unattended

A simple update package for Go

Note: This is a Go implementation of the original .NET Unattended package

Limitations compared to the .NET version

The .NET version checks and updates DLLs in addition to the primary executable. Go builds to a single binary and does not need additional DLLs to be present. Once Go's plugins are supported on all platforms the additional functionality to check their versions and update independently might be implemented.

go-unattended is still able to update the binary together with any other included files and folders as with the .NET version.

Documentation and Getting Started Guide

Available at the Project Limitless Documentation site. The documentation is for the .NET version of the package, but the same tutorial can be followed and used with the sample code in the example folder.

Documentation

Overview

Package unattended implements a simple update package for Go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Target

type Target struct {
	// AppID is the unique ID of the application to use in checking for updates
	AppID string
	// UpdateEndpoint is the Unattended server endpoint serving updates
	UpdateEndpoint string
	// UpdateChannel defines the update channel, can be 'stable', 'beta' or any
	// other value defined by the Unattended server
	UpdateChannel string
	// VersionsPath is the base path to where the versioned directories were
	// installed to
	VersionsPath string
	// ApplicationName is the name of the executable to run
	ApplicationName string
	// ApplicationParameters to use in executing the target
	ApplicationParameters []string
}

Target defines the target application to be controlled and updated by Unattended

func (*Target) LatestVersion

func (target *Target) LatestVersion() string

LatestVersion returns the latest version installed of the target

type Unattended

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

Unattended implements the core functionality of the package. It takes ownership of running and updating a target application

func New

func New(
	clientID string,
	target Target,
	updateCheckInterval time.Duration,
	log *logrus.Entry) (*Unattended, error)

New creates a new instance of the unattended updater

func (*Unattended) ApplyUpdates

func (updater *Unattended) ApplyUpdates() (bool, error)

ApplyUpdates downloads and applies downloads if they are available

func (*Unattended) DownloadAndVerifyPackage

func (updater *Unattended) DownloadAndVerifyPackage(
	manifest omaha.Manifest,
	tempPath string) (string, error)

DownloadAndVerifyPackage downloads and verifies the package from the given manifest and returns the downloaded location

func (*Unattended) GetLatestVersion

func (updater *Unattended) GetLatestVersion() string

GetLatestVersion returns the latest installed version

func (*Unattended) Restart

func (updater *Unattended) Restart() error

Restart the target application

func (*Unattended) Run

func (updater *Unattended) Run() error

Run starts the target application and the update check loop.

If any updates are found for targets in UpdateManifests they will be downloaded, applied and the target application restarted

func (*Unattended) RunWithoutUpdate

func (updater *Unattended) RunWithoutUpdate() error

RunWithoutUpdate starts the target application without checking for updates

func (*Unattended) SetOutputWriter

func (updater *Unattended) SetOutputWriter(writer io.Writer)

SetOutputWriter sets the writer to write the target's output to

func (*Unattended) Stop

func (updater *Unattended) Stop() error

Stop the target application

Directories

Path Synopsis
Package main implements a simple sample of the unattended package
Package main implements a simple sample of the unattended package
Package omaha implements a subset of the Google Omaha update protocol https://github.com/google/omaha
Package omaha implements a subset of the Google Omaha update protocol https://github.com/google/omaha

Jump to

Keyboard shortcuts

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