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
|
|
}
|