2018-11-07 10:35:04 +00:00
|
|
|
package pkg
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
)
|
|
|
|
|
2018-11-11 00:10:30 +00:00
|
|
|
type apk struct{}
|
2018-11-07 10:35:04 +00:00
|
|
|
|
2018-11-11 00:10:30 +00:00
|
|
|
func (d apk) Name() string { return "apk" }
|
2018-11-07 10:35:04 +00:00
|
|
|
|
2018-11-11 00:10:30 +00:00
|
|
|
func (d apk) Fetch() error {
|
2018-11-08 11:52:14 +00:00
|
|
|
return exec.Command(d.Name(), "update").Run()
|
2018-11-07 10:35:04 +00:00
|
|
|
}
|
|
|
|
|
2018-11-11 00:10:30 +00:00
|
|
|
func (d apk) Upgrade() error {
|
2018-11-08 11:52:14 +00:00
|
|
|
return exec.Command(d.Name(), "upgrade").Run()
|
2018-11-07 10:35:04 +00:00
|
|
|
}
|
|
|
|
|
2018-11-11 00:10:30 +00:00
|
|
|
func (d apk) Install(_pkg string) error {
|
2018-11-08 11:52:14 +00:00
|
|
|
return exec.Command(d.Name(), "add", _pkg).Run()
|
2018-11-07 10:35:04 +00:00
|
|
|
}
|
|
|
|
|
2018-11-11 00:10:30 +00:00
|
|
|
func (d apk) Remove(_pkg string) error {
|
2018-11-08 11:52:14 +00:00
|
|
|
return exec.Command(d.Name(), "del", _pkg).Run()
|
2018-11-07 10:35:04 +00:00
|
|
|
}
|