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