30 lines
533 B
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
|
|
}
|