installer

package
v14.7.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: MIT Imports: 22 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNeedLocal = errors.New("install source needs to be available locally")

Functions

func AsLocalFile

func AsLocalFile(f eos.File) (*os.File, error)

AsLocalFile takes an eos.File and tries to cast it to an *os.File. If that fails, it returns `ErrNeedLocal`. Consumers of functions that call + relay AsLocalFile's errors are expected to know how to download a file to disk and call again with an *os.File instance instead of, say, an *htfs.File

func CheckExitCode

func CheckExitCode(exitCode int, err error) error

func IsWindowsInstaller

func IsWindowsInstaller(typ InstallerType) bool

func RegisterManager

func RegisterManager(m Manager)

func RunCommand

func RunCommand(consumer *state.Consumer, cmdTokens []string) (int, error)

RunCommand starts and waits for an *exec.Cmd to finish, and goes through a weird type-casting dance to retrieve the actual exit code.

func RunElevatedCommand

func RunElevatedCommand(consumer *state.Consumer, cmdTokens []string) (int, error)

Types

type Any

type Any map[string]interface{}

type InstallParams

type InstallParams struct {
	// An archive file, .exe setup file, .dmg file etc.
	File eos.File

	// The existing receipt, if any
	ReceiptIn *bfs.Receipt

	// A folder we can use to store temp files
	StageFolderPath string

	// The folder we're installing to
	InstallFolderPath string

	// Listener for progress events, logging etc.
	Consumer *state.Consumer

	InstallerInfo *InstallerInfo

	// For cancellation
	Context context.Context
}

type InstallResult

type InstallResult struct {
	// Files is a list of paths, relative to the install folder
	Files []string

	// optional, installer-specific fields:
	MSIProductCode string
}

type InstallerInfo

type InstallerInfo struct {
	Type        InstallerType
	ArchiveInfo *boar.Info
	Entries     []*savior.Entry
}

func GetInstallerInfo

func GetInstallerInfo(consumer *state.Consumer, file eos.File) (*InstallerInfo, error)

type InstallerType

type InstallerType string
const (
	InstallerTypeNaked       InstallerType = "naked"
	InstallerTypeArchive     InstallerType = "archive"
	InstallerTypeDMG         InstallerType = "dmg"
	InstallerTypeInno        InstallerType = "inno"
	InstallerTypeNsis        InstallerType = "nsis"
	InstallerTypeMSI         InstallerType = "msi"
	InstallerTypeUnknown     InstallerType = "unknown"
	InstallerTypeUnsupported InstallerType = "unsupported"
)

type Manager

type Manager interface {
	Install(params *InstallParams) (*InstallResult, error)
	Uninstall(params *UninstallParams) error
	Name() string
}

func GetManager

func GetManager(name string) Manager

type OnResultFunc

type OnResultFunc func(res Any)

type RunSelfParams

type RunSelfParams struct {
	Consumer *state.Consumer
	Args     []string
	OnResult OnResultFunc
}

type RunSelfResult

type RunSelfResult struct {
	ExitCode int
	Results  []Any
	Errors   []string
}

func RunSelf

func RunSelf(params *RunSelfParams) (*RunSelfResult, error)

type UninstallParams

type UninstallParams struct {
	// The folder we're uninstalling from
	InstallFolderPath string

	// Listener for progress events, logging etc.
	Consumer *state.Consumer

	// Receipt at the time we asked for an uninstall
	Receipt *bfs.Receipt
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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