29 lines
492 B
Go
29 lines
492 B
Go
|
package pkg
|
||
|
|
||
|
import (
|
||
|
"os/exec"
|
||
|
)
|
||
|
|
||
|
type Yum struct{}
|
||
|
|
||
|
func (d Yum) Name() string { return "yum" }
|
||
|
|
||
|
func (d Yum) Fetch() bool {
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
func (d Yum) Upgrade() bool {
|
||
|
_, err := exec.Command(d.Name(), "update").Output()
|
||
|
return err == nil
|
||
|
}
|
||
|
|
||
|
func (d Yum) Install(_pkg string) bool {
|
||
|
_, err := exec.Command(d.Name(), "install", _pkg).Output()
|
||
|
return err == nil
|
||
|
}
|
||
|
|
||
|
func (d Yum) Remove(_pkg string) bool {
|
||
|
_, err := exec.Command(d.Name(), "remove", _pkg).Output()
|
||
|
return err == nil
|
||
|
}
|