Documentation
¶
Overview ¶
Package packages provides package management functions for Windows and Linux systems.
Index ¶
- Variables
- func AptUpdate(ctx context.Context) ([]byte, error)
- func DpkgInstall(ctx context.Context, path string) error
- func InstallAptPackages(ctx context.Context, pkgs []string) error
- func InstallGooGetPackages(ctx context.Context, pkgs []string) error
- func InstallMSIPackage(_ context.Context, _ string, _ []string) error
- func InstallYumPackages(ctx context.Context, pkgs []string) error
- func InstallZypperPackages(ctx context.Context, pkgs []string) error
- func MSIInfo(_ string) (string, string, error)
- func MSIInstalled(_ string) (bool, error)
- func RPMInstall(ctx context.Context, path string) error
- func RemoveAptPackages(ctx context.Context, pkgs []string) error
- func RemoveGooGetPackages(ctx context.Context, pkgs []string) error
- func RemoveYumPackages(ctx context.Context, pkgs []string) error
- func RemoveZypperPackages(ctx context.Context, pkgs []string) error
- func SetCommandRunner(commandRunner util.CommandRunner)
- func SetPtyCommandRunner(commandRunner util.CommandRunner)
- func ZypperInstall(ctx context.Context, patches []*ZypperPatch, pkgs []*PkgInfo) error
- func ZypperPackagesInPatch(ctx context.Context, patches []*ZypperPatch) (map[string][]string, error)
- type AptGetUpgradeOption
- type AptUpgradeType
- type InstalledPackagesProvider
- type PackageUpdatesProvider
- type Packages
- type PkgInfo
- func AptUpdates(ctx context.Context, opts ...AptGetUpgradeOption) ([]*PkgInfo, error)
- func DebPkgInfo(ctx context.Context, path string) (*PkgInfo, error)
- func GemUpdates(ctx context.Context) ([]*PkgInfo, error)
- func GooGetUpdates(ctx context.Context) ([]*PkgInfo, error)
- func InstalledCOSPackages() ([]*PkgInfo, error)
- func InstalledDebPackages(ctx context.Context) ([]*PkgInfo, error)
- func InstalledGemPackages(ctx context.Context) ([]*PkgInfo, error)
- func InstalledGooGetPackages(ctx context.Context) ([]*PkgInfo, error)
- func InstalledPipPackages(ctx context.Context) ([]*PkgInfo, error)
- func InstalledRPMPackages(ctx context.Context) ([]*PkgInfo, error)
- func PipUpdates(ctx context.Context) ([]*PkgInfo, error)
- func RPMPkgInfo(ctx context.Context, path string) (*PkgInfo, error)
- func YumUpdates(ctx context.Context, opts ...YumUpdateOption) ([]*PkgInfo, error)
- func ZypperUpdates(ctx context.Context) ([]*PkgInfo, error)
- type QFEPackage
- type Source
- type WUAPackage
- type WindowsApplication
- type YumUpdateOption
- type ZypperListOption
- type ZypperPatch
Constants ¶
This section is empty.
Variables ¶
var ( // AptExists indicates whether apt is installed. AptExists bool // DpkgExists indicates whether dpkg is installed. DpkgExists bool // DpkgQueryExists indicates whether dpkg-query is installed. DpkgQueryExists bool // YumExists indicates whether yum is installed. YumExists bool // ZypperExists indicates whether zypper is installed. ZypperExists bool // RPMExists indicates whether rpm is installed. RPMExists bool // RPMQueryExists indicates whether rpmquery is installed. RPMQueryExists bool // COSPkgInfoExists indicates whether COS package information is available. COSPkgInfoExists bool // GemExists indicates whether gem is installed. GemExists bool // PipExists indicates whether pip is installed. PipExists bool // GooGetExists indicates whether googet is installed. GooGetExists bool // MSIExists indicates whether MSIs can be installed. MSIExists bool )
Functions ¶
func DpkgInstall ¶
DpkgInstall installs a deb package.
func InstallAptPackages ¶
InstallAptPackages installs apt packages.
func InstallGooGetPackages ¶
InstallGooGetPackages installs GooGet packages.
func InstallMSIPackage ¶
InstallMSIPackage is a linux stub function.
func InstallYumPackages ¶
InstallYumPackages installs yum packages.
func InstallZypperPackages ¶
InstallZypperPackages Installs zypper packages
func MSIInstalled ¶
MSIInstalled is a linux stub function.
func RPMInstall ¶
RPMInstall installs an rpm packages.
func RemoveAptPackages ¶
RemoveAptPackages removes apt packages.
func RemoveGooGetPackages ¶
RemoveGooGetPackages installs GooGet packages.
func RemoveYumPackages ¶
RemoveYumPackages removes yum packages.
func RemoveZypperPackages ¶
RemoveZypperPackages installed Zypper packages.
func SetCommandRunner ¶
func SetCommandRunner(commandRunner util.CommandRunner)
SetCommandRunner allows external clients to set a custom commandRunner.
func SetPtyCommandRunner ¶
func SetPtyCommandRunner(commandRunner util.CommandRunner)
SetPtyCommandRunner allows external clients to set a custom custom commandRunner.
func ZypperInstall ¶
func ZypperInstall(ctx context.Context, patches []*ZypperPatch, pkgs []*PkgInfo) error
ZypperInstall installs zypper patches and packages
func ZypperPackagesInPatch ¶
func ZypperPackagesInPatch(ctx context.Context, patches []*ZypperPatch) (map[string][]string, error)
ZypperPackagesInPatch returns the list of patches, a package upgrade belongs to
Types ¶
type AptGetUpgradeOption ¶
type AptGetUpgradeOption func(*aptGetUpgradeOpts)
AptGetUpgradeOption is an option for apt-get upgrade.
func AptGetUpgradeAllowDowngrades ¶
func AptGetUpgradeAllowDowngrades(allowDowngrades bool) AptGetUpgradeOption
AptGetUpgradeAllowDowngrades returns a AptGetUpgradeOption that specifies AllowDowngrades.
func AptGetUpgradeShowNew ¶
func AptGetUpgradeShowNew(showNew bool) AptGetUpgradeOption
AptGetUpgradeShowNew returns a AptGetUpgradeOption that indicates whether 'new' packages should be returned.
func AptGetUpgradeType ¶
func AptGetUpgradeType(upgradeType AptUpgradeType) AptGetUpgradeOption
AptGetUpgradeType returns a AptGetUpgradeOption that specifies upgrade type.
type AptUpgradeType ¶
type AptUpgradeType int
AptUpgradeType is the apt upgrade type.
const ( // AptGetUpgrade specifies apt-get upgrade should be run. AptGetUpgrade AptUpgradeType = iota // AptGetDistUpgrade specifies apt-get dist-upgrade should be run. AptGetDistUpgrade // AptGetFullUpgrade specifies apt-get full-upgrade should be run. AptGetFullUpgrade )
type InstalledPackagesProvider ¶
type InstalledPackagesProvider interface {
GetInstalledPackages(context.Context) (Packages, error)
}
InstalledPackagesProvider define contract to extract installed packages from the VM.
func NewInstalledPackagesProvider ¶
func NewInstalledPackagesProvider(osinfoProvider osinfo.Provider) InstalledPackagesProvider
NewInstalledPackagesProvider makes provider that uses osv-scalibr as its implementation if enabled by config, otherwise falls back to default legacy implementation.
func TracingInstalledPackagesProvider ¶
func TracingInstalledPackagesProvider(tracedProvider InstalledPackagesProvider, osInfoProvider osinfo.Provider) InstalledPackagesProvider
TracingInstalledPackagesProvider creates an InstalledPackagesProvider decorator that traces the execution time, memory usage, and OS information for each call.
type PackageUpdatesProvider ¶
PackageUpdatesProvider define contract to extract available updates from the VM.
func NewPackageUpdatesProvider ¶
func NewPackageUpdatesProvider() PackageUpdatesProvider
NewPackageUpdatesProvider return fully initialize provider.
type Packages ¶
type Packages struct {
Yum []*PkgInfo `json:"yum,omitempty"`
Rpm []*PkgInfo `json:"rpm,omitempty"`
Apt []*PkgInfo `json:"apt,omitempty"`
Deb []*PkgInfo `json:"deb,omitempty"`
Zypper []*PkgInfo `json:"zypper,omitempty"`
ZypperPatches []*ZypperPatch `json:"zypperPatches,omitempty"`
COS []*PkgInfo `json:"cos,omitempty"`
Gem []*PkgInfo `json:"gem,omitempty"`
Pip []*PkgInfo `json:"pip,omitempty"`
GooGet []*PkgInfo `json:"googet,omitempty"`
WUA []*WUAPackage `json:"wua,omitempty"`
QFE []*QFEPackage `json:"qfe,omitempty"`
WindowsApplication []*WindowsApplication `json:"-"`
}
Packages is a selection of packages based on their manager.
func GetInstalledPackages ¶
GetInstalledPackages gets all installed packages from any known installed package manager.
type PkgInfo ¶
PkgInfo describes a package.
func AptUpdates ¶
func AptUpdates(ctx context.Context, opts ...AptGetUpgradeOption) ([]*PkgInfo, error)
AptUpdates returns all the packages that will be installed when running apt-get [dist-|full-]upgrade.
func DebPkgInfo ¶
DebPkgInfo gets PkgInfo from a deb package.
func GemUpdates ¶
GemUpdates queries for all available gem updates.
func GooGetUpdates ¶
GooGetUpdates queries for all available googet updates.
func InstalledCOSPackages ¶
InstalledCOSPackages queries for all installed COS packages.
func InstalledDebPackages ¶
InstalledDebPackages queries for all installed deb packages.
func InstalledGemPackages ¶
InstalledGemPackages queries for all installed gem packages.
func InstalledGooGetPackages ¶
InstalledGooGetPackages queries for all installed googet packages.
func InstalledPipPackages ¶
InstalledPipPackages queries for all installed pip packages.
func InstalledRPMPackages ¶
InstalledRPMPackages queries for all installed rpm packages.
func PipUpdates ¶
PipUpdates queries for all available pip updates.
func RPMPkgInfo ¶
RPMPkgInfo gets PkgInfo from a rpm package.
func YumUpdates ¶
func YumUpdates(ctx context.Context, opts ...YumUpdateOption) ([]*PkgInfo, error)
YumUpdates queries for all available yum updates.
func ZypperUpdates ¶
ZypperUpdates queries for all available zypper updates.
type QFEPackage ¶
type QFEPackage struct {
Caption, Description, HotFixID, InstalledOn string
}
QFEPackage describes a Windows Quick Fix Engineering package.
type Source ¶
type Source struct {
Name, Version string
}
Source represents source package from which binary package was built.
type WUAPackage ¶
type WUAPackage struct {
LastDeploymentChangeTime time.Time
Title string
Description string
SupportURL string
UpdateID string
Categories []string
KBArticleIDs []string
MoreInfoURLs []string
CategoryIDs []string
RevisionNumber int32
}
WUAPackage describes a Windows Update Agent package.
type WindowsApplication ¶
type WindowsApplication struct {
DisplayName string
DisplayVersion string
InstallDate time.Time
Publisher string
HelpLink string
}
WindowsApplication describes a Windows Application.
type YumUpdateOption ¶
type YumUpdateOption func(*yumUpdateOpts)
YumUpdateOption is an option for yum update.
func YumUpdateMinimal ¶
func YumUpdateMinimal(minimal bool) YumUpdateOption
YumUpdateMinimal returns a YumUpdateOption that specifies the update-minimal command should be used.
func YumUpdateSecurity ¶
func YumUpdateSecurity(security bool) YumUpdateOption
YumUpdateSecurity returns a YumUpdateOption that specifies the --security flag should be used.
type ZypperListOption ¶
type ZypperListOption func(opts *zypperListPatchOpts)
ZypperListOption is patch list options
func ZypperListPatchAll ¶
func ZypperListPatchAll(all bool) ZypperListOption
ZypperListPatchAll is zypper list option to all all patches
func ZypperListPatchCategories ¶
func ZypperListPatchCategories(categories []string) ZypperListOption
ZypperListPatchCategories is zypper list option to provide category filter
func ZypperListPatchSeverities ¶
func ZypperListPatchSeverities(severities []string) ZypperListOption
ZypperListPatchSeverities is zypper list option to provide severity filter
func ZypperListPatchWithOptional ¶
func ZypperListPatchWithOptional(withOptional bool) ZypperListOption
ZypperListPatchWithOptional is zypper list option to also list optional patches
type ZypperPatch ¶
type ZypperPatch struct {
Name, Category, Severity, Summary string
}
ZypperPatch describes a Zypper patch.
func ZypperInstalledPatches ¶
func ZypperInstalledPatches(ctx context.Context, opts ...ZypperListOption) ([]*ZypperPatch, error)
ZypperInstalledPatches queries for all installed zypper patches.
func ZypperPatches ¶
func ZypperPatches(ctx context.Context, opts ...ZypperListOption) ([]*ZypperPatch, error)
ZypperPatches queries for all available zypper patches.