nix-amer/internal/pkg/common.go

25 lines
781 B
Go
Raw Permalink Normal View History

package pkg
import (
"git.xdrm.io/go/nix-amer/internal/exec"
)
2018-11-11 18:01:00 +00:00
// DefaultManager if not empty is the default package-manager to use when missing
var DefaultManager = ""
// PackageManager is the common interface for all package-manager drivers (e.g. `dpkg` for debian-based, `pacman` for arch)
type PackageManager interface {
// SetExecContext sets the execution context, default is os/exec
SetExecutor(exec.Executor)
// Name of executable (to check if installed and for debug)
Name() string
// Fetch updates the package cache/databse
Fetch() error
// Upgrade already installed packages and whatever can be upgraded with warranty (e.g. kernel)
Upgrade() error
// Install a given package
Install(string) error
// Remove a package given package
Remove(string) error
}