2018-11-07 10:35:04 +00:00
|
|
|
package pkg
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
)
|
|
|
|
|
2018-11-11 00:10:30 +00:00
|
|
|
type pacman struct{}
|
2018-11-07 10:35:04 +00:00
|
|
|
|
2018-11-11 00:10:30 +00:00
|
|
|
func (d pacman) Name() string { return "pacman" }
|
2018-11-07 10:35:04 +00:00
|
|
|
|
2018-11-11 00:10:30 +00:00
|
|
|
func (d pacman) Fetch() error {
|
2018-11-08 11:52:14 +00:00
|
|
|
return nil
|
2018-11-07 10:35:04 +00:00
|
|
|
}
|
|
|
|
|
2018-11-11 00:10:30 +00:00
|
|
|
func (d pacman) Upgrade() error {
|
2018-11-08 11:52:14 +00:00
|
|
|
err := exec.Command(d.Name(), "-Syu").Run()
|
2018-11-07 10:35:04 +00:00
|
|
|
exec.Command(d.Name(), "-Ru").Run()
|
2018-11-08 11:52:14 +00:00
|
|
|
return err
|
2018-11-07 10:35:04 +00:00
|
|
|
}
|
|
|
|
|
2018-11-11 00:10:30 +00:00
|
|
|
func (d pacman) Install(_pkg string) error {
|
2018-11-08 11:52:14 +00:00
|
|
|
err := exec.Command(d.Name(), "-S", _pkg).Run()
|
|
|
|
return err
|
2018-11-07 10:35:04 +00:00
|
|
|
}
|
|
|
|
|
2018-11-11 00:10:30 +00:00
|
|
|
func (d pacman) Remove(_pkg string) error {
|
2018-11-08 11:52:14 +00:00
|
|
|
err := exec.Command(d.Name(), "-R", _pkg).Run()
|
2018-11-07 10:35:04 +00:00
|
|
|
exec.Command(d.Name(), "-Ru").Run()
|
2018-11-08 11:52:14 +00:00
|
|
|
return err
|
2018-11-07 10:35:04 +00:00
|
|
|
}
|