nix-amer/internal/pkg/dnf.go

30 lines
533 B
Go

package pkg
import (
"os/exec"
)
type Dnf struct{}
func (d Dnf) Name() string { return "dnf" }
func (d Dnf) Fetch() error {
return nil
}
func (d Dnf) Upgrade() error {
err := exec.Command(d.Name(), "upgrade").Run()
exec.Command(d.Name(), "autoremove").Run()
return err
}
func (d Dnf) Install(_pkg string) error {
return exec.Command(d.Name(), "install", _pkg).Run()
}
func (d Dnf) Remove(_pkg string) error {
err := exec.Command(d.Name(), "remove", _pkg).Run()
exec.Command(d.Name(), "autoremove").Run()
return err
}