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