31 lines
576 B
Go
31 lines
576 B
Go
|
package pkg
|
||
|
|
||
|
import (
|
||
|
"os/exec"
|
||
|
)
|
||
|
|
||
|
type Pacman struct{}
|
||
|
|
||
|
func (d Pacman) Name() string { return "pacman" }
|
||
|
|
||
|
func (d Pacman) Fetch() bool {
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
func (d Pacman) Upgrade() bool {
|
||
|
_, err := exec.Command(d.Name(), "-Syu").Output()
|
||
|
exec.Command(d.Name(), "-Ru").Run()
|
||
|
return err == nil
|
||
|
}
|
||
|
|
||
|
func (d Pacman) Install(_pkg string) bool {
|
||
|
_, err := exec.Command(d.Name(), "-S", _pkg).Output()
|
||
|
return err == nil
|
||
|
}
|
||
|
|
||
|
func (d Pacman) Remove(_pkg string) bool {
|
||
|
_, err := exec.Command(d.Name(), "-R", _pkg).Output()
|
||
|
exec.Command(d.Name(), "-Ru").Run()
|
||
|
return err == nil
|
||
|
}
|