nix-amer/internal/pkg/common.go

25 lines
791 B
Go

package pkg
import (
"github.com/xdrm-brackets/nix-amer/internal/exec"
)
// 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
}