nix-amer/internal/pkg/apk.go

30 lines
545 B
Go
Raw Normal View History

package pkg
import (
"os/exec"
)
type Apk struct{}
func (d Apk) Name() string { return "apk" }
func (d Apk) Fetch() bool {
_, err := exec.Command(d.Name(), "update").Output()
return err == nil
}
func (d Apk) Upgrade() bool {
_, err := exec.Command(d.Name(), "upgrade").Output()
return err == nil
}
func (d Apk) Install(_pkg string) bool {
_, err := exec.Command(d.Name(), "add", _pkg).Output()
return err == nil
}
func (d Apk) Remove(_pkg string) bool {
_, err := exec.Command(d.Name(), "del", _pkg).Output()
return err == nil
}