32 lines
656 B
Go
32 lines
656 B
Go
package pkg
|
|
|
|
import "git.xdrm.io/go/nix-amer/internal/exec"
|
|
|
|
type dnf struct{ exec exec.Executor }
|
|
|
|
func (d *dnf) SetExecutor(_exec exec.Executor) {
|
|
d.exec = _exec
|
|
}
|
|
|
|
func (d dnf) Name() string { return "dnf" }
|
|
|
|
func (d dnf) Fetch() error {
|
|
return nil
|
|
}
|
|
|
|
func (d dnf) Upgrade() error {
|
|
err := d.exec.Command(d.Name(), "upgrade").Run()
|
|
d.exec.Command(d.Name(), "autoremove").Run()
|
|
return err
|
|
}
|
|
|
|
func (d dnf) Install(_pkg string) error {
|
|
return d.exec.Command(d.Name(), "install", _pkg).Run()
|
|
}
|
|
|
|
func (d dnf) Remove(_pkg string) error {
|
|
err := d.exec.Command(d.Name(), "remove", _pkg).Run()
|
|
d.exec.Command(d.Name(), "autoremove").Run()
|
|
return err
|
|
}
|