msi

package
v0.0.0-...-f8e543c Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Rendered for windows/amd64

Overview

Package msi contains helper functions to work with msi packages

Package msi contains helper functions to work with msi packages

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsProductInstalled

func IsProductInstalled(productName string) bool

IsProductInstalled returns true if the given productName is installed

func RemoveProduct

func RemoveProduct(productName string) error

RemoveProduct uses the registry to try and find a product and use msiexec to remove it. It is different from msiexec in that it uses the registry and not the stable/experiment path on disk to uninstall the product. This is needed because in certain circumstances the installer database stored in the stable/experiment paths does not reflect the installed version, and using those installers can lead to undefined behavior (either failure to uninstall, or weird bugs from uninstalling a product with an installer from a different version).

Types

type Msiexec

type Msiexec struct {
	*exec.Cmd
	// contains filtered or unexported fields
}

Msiexec is a type wrapping msiexec

func Cmd

func Cmd(options ...MsiexecOption) (*Msiexec, error)

Cmd creates a new Msiexec wrapper around cmd.Exec that will call msiexec

func (*Msiexec) FireAndForget

func (m *Msiexec) FireAndForget() error

FireAndForget starts msiexec and doesn't wait for it to finish. The log file won't be read at the end and post execution actions will not be executed.

func (*Msiexec) Run

func (m *Msiexec) Run() ([]byte, error)

Run runs msiexec synchronously

func (*Msiexec) RunAsync

func (m *Msiexec) RunAsync(done func([]byte, error)) error

RunAsync runs msiexec asynchronously

type MsiexecOption

type MsiexecOption func(*msiexecArgs) error

MsiexecOption is an option type for creating msiexec command lines

func Install

func Install() MsiexecOption

Install specifies that msiexec will be invoked to install a product

func Uninstall

func Uninstall() MsiexecOption

Uninstall specifies that msiexec will be invoked to uninstall a product

func WithAdditionalArgs

func WithAdditionalArgs(additionalArgs []string) MsiexecOption

WithAdditionalArgs specifies additional arguments for msiexec

func WithDdAgentUserName

func WithDdAgentUserName(ddagentUserName string) MsiexecOption

WithDdAgentUserName specifies the DDAGENTUSER_NAME to use

func WithLogFile

func WithLogFile(logFile string) MsiexecOption

WithLogFile specifies the log file for msiexec

func WithMsi

func WithMsi(target string) MsiexecOption

WithMsi specifies the MSI target for msiexec

func WithMsiFromPackagePath

func WithMsiFromPackagePath(target, product string) MsiexecOption

WithMsiFromPackagePath finds an MSI from the packages folder

func WithProduct

func WithProduct(productName string) MsiexecOption

WithProduct specifies the product name to target for msiexec

type Product

type Product struct {
	// Code is the software product code
	Code string
	// UninstallString is the string that can be executed to uninstall the software. May be empty.
	UninstallString string
}

Product represents a software from the Windows Registry

func FindProductCode

func FindProductCode(productName string) (*Product, error)

FindProductCode looks for the productName in the registry and returns information about it

type TextRange

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

TextRange is a simple struct to represent a range of text in a file.

func Combine

func Combine(input []byte, processors ...logFileProcessor) []TextRange

Combine processes input using multiple logFileProcessors and merges their output ranges.

func FindAllIndexWithContext

func FindAllIndexWithContext(r *regexp.Regexp, input []byte, contextBefore, contextAfter int) []TextRange

FindAllIndexWithContext is similar to FindAllIndex but expands the matched range for a number of lines before and after the TextRange (called contextBefore and contextAfter).

Jump to

Keyboard shortcuts

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