pkgmanager

package
v0.0.0-...-ba43356 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package management on the host system.

Index

Constants

This section is empty.

Variables

View Source
var FindPackageManager = func() (PacakgeManager, error) {
	if cachedManager != nil {
		return cachedManager, nil
	}

	possibleManagers := sys.SupportedPackageManagers()
	for _, mgr := range possibleManagers {
		if _, err := run.Find(mgr); err == nil && Managers[mgr] != nil {
			cachedManager = Managers[mgr]
			return Managers[mgr], nil
		}
	}

	return nil, errors.New("unable to find a supported package manager on host system")
}
View Source
var Managers = map[string]PacakgeManager{
	"apk":    apk,
	"apt":    apt,
	"brew":   brew,
	"dnf":    dnf,
	"snap":   snap,
	"pacman": pacman,
}

Functions

func ResetCachedManager

func ResetCachedManager()

Types

type PacakgeManager

type PacakgeManager interface {
	Name() string
	AddPackage(*model.Package) error
	RemovePackage(string) error
	ListPackages() ([]*model.Package, error)
	FmtPackageVersion(*model.Package) string
}

Jump to

Keyboard shortcuts

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