nix-amer/internal/pkg/eopkg.go

31 lines
603 B
Go
Raw Normal View History

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