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