unexport private package managers (internal/pkg)
This commit is contained in:
parent
7475f0bd24
commit
87f983d018
|
@ -4,22 +4,22 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Apk struct{}
|
type apk struct{}
|
||||||
|
|
||||||
func (d Apk) Name() string { return "apk" }
|
func (d apk) Name() string { return "apk" }
|
||||||
|
|
||||||
func (d Apk) Fetch() error {
|
func (d apk) Fetch() error {
|
||||||
return exec.Command(d.Name(), "update").Run()
|
return exec.Command(d.Name(), "update").Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Apk) Upgrade() error {
|
func (d apk) Upgrade() error {
|
||||||
return exec.Command(d.Name(), "upgrade").Run()
|
return exec.Command(d.Name(), "upgrade").Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Apk) Install(_pkg string) error {
|
func (d apk) Install(_pkg string) error {
|
||||||
return exec.Command(d.Name(), "add", _pkg).Run()
|
return exec.Command(d.Name(), "add", _pkg).Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Apk) Remove(_pkg string) error {
|
func (d apk) Remove(_pkg string) error {
|
||||||
return exec.Command(d.Name(), "del", _pkg).Run()
|
return exec.Command(d.Name(), "del", _pkg).Run()
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,16 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Apt struct{}
|
type aptGet struct{}
|
||||||
|
|
||||||
func (d Apt) Name() string { return "apt-get" }
|
func (d aptGet) Name() string { return "apt-get" }
|
||||||
|
|
||||||
func (d Apt) Fetch() error {
|
func (d aptGet) Fetch() error {
|
||||||
err := exec.Command(d.Name(), "update").Run()
|
err := exec.Command(d.Name(), "update").Run()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Apt) Upgrade() error {
|
func (d aptGet) Upgrade() error {
|
||||||
err := exec.Command(d.Name(), "upgrade").Run()
|
err := exec.Command(d.Name(), "upgrade").Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -28,12 +28,12 @@ func (d Apt) Upgrade() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Apt) Install(_pkg string) error {
|
func (d aptGet) Install(_pkg string) error {
|
||||||
err := exec.Command(d.Name(), "install", _pkg).Run()
|
err := exec.Command(d.Name(), "install", _pkg).Run()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Apt) Remove(_pkg string) error {
|
func (d aptGet) Remove(_pkg string) error {
|
||||||
err := exec.Command(d.Name(), "remove", _pkg).Run()
|
err := exec.Command(d.Name(), "remove", _pkg).Run()
|
||||||
exec.Command(d.Name(), "autoremove").Run()
|
exec.Command(d.Name(), "autoremove").Run()
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -4,25 +4,25 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Dnf struct{}
|
type dnf struct{}
|
||||||
|
|
||||||
func (d Dnf) Name() string { return "dnf" }
|
func (d dnf) Name() string { return "dnf" }
|
||||||
|
|
||||||
func (d Dnf) Fetch() error {
|
func (d dnf) Fetch() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Dnf) Upgrade() error {
|
func (d dnf) Upgrade() error {
|
||||||
err := exec.Command(d.Name(), "upgrade").Run()
|
err := exec.Command(d.Name(), "upgrade").Run()
|
||||||
exec.Command(d.Name(), "autoremove").Run()
|
exec.Command(d.Name(), "autoremove").Run()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Dnf) Install(_pkg string) error {
|
func (d dnf) Install(_pkg string) error {
|
||||||
return exec.Command(d.Name(), "install", _pkg).Run()
|
return exec.Command(d.Name(), "install", _pkg).Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Dnf) Remove(_pkg string) error {
|
func (d dnf) Remove(_pkg string) error {
|
||||||
err := exec.Command(d.Name(), "remove", _pkg).Run()
|
err := exec.Command(d.Name(), "remove", _pkg).Run()
|
||||||
exec.Command(d.Name(), "autoremove").Run()
|
exec.Command(d.Name(), "autoremove").Run()
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -4,26 +4,26 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Eopkg struct{}
|
type eopkg struct{}
|
||||||
|
|
||||||
func (d Eopkg) Name() string { return "eopkg" }
|
func (d eopkg) Name() string { return "eopkg" }
|
||||||
|
|
||||||
func (d Eopkg) Fetch() error {
|
func (d eopkg) Fetch() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Eopkg) Upgrade() error {
|
func (d eopkg) Upgrade() error {
|
||||||
err := exec.Command(d.Name(), "upgrade").Run()
|
err := exec.Command(d.Name(), "upgrade").Run()
|
||||||
exec.Command(d.Name(), "remove-orphans").Run()
|
exec.Command(d.Name(), "remove-orphans").Run()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Eopkg) Install(_pkg string) error {
|
func (d eopkg) Install(_pkg string) error {
|
||||||
err := exec.Command(d.Name(), "install", _pkg).Run()
|
err := exec.Command(d.Name(), "install", _pkg).Run()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Eopkg) Remove(_pkg string) error {
|
func (d eopkg) Remove(_pkg string) error {
|
||||||
err := exec.Command(d.Name(), "remove", _pkg).Run()
|
err := exec.Command(d.Name(), "remove", _pkg).Run()
|
||||||
exec.Command(d.Name(), "remove-orphans").Run()
|
exec.Command(d.Name(), "remove-orphans").Run()
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -13,17 +13,17 @@ func Load(_manager string) (PackageManager, error) {
|
||||||
var manager PackageManager
|
var manager PackageManager
|
||||||
switch _manager {
|
switch _manager {
|
||||||
case "apt-get":
|
case "apt-get":
|
||||||
manager = new(Apt)
|
manager = new(aptGet)
|
||||||
case "apk":
|
case "apk":
|
||||||
manager = new(Apk)
|
manager = new(apk)
|
||||||
case "eopkg":
|
case "eopkg":
|
||||||
manager = new(Eopkg)
|
manager = new(eopkg)
|
||||||
case "pacman":
|
case "pacman":
|
||||||
manager = new(Pacman)
|
manager = new(pacman)
|
||||||
case "dnf":
|
case "dnf":
|
||||||
manager = new(Dnf)
|
manager = new(dnf)
|
||||||
case "yum":
|
case "yum":
|
||||||
manager = new(Yum)
|
manager = new(yum)
|
||||||
default:
|
default:
|
||||||
return nil, ErrUnknownManager
|
return nil, ErrUnknownManager
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,26 +4,26 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Pacman struct{}
|
type pacman struct{}
|
||||||
|
|
||||||
func (d Pacman) Name() string { return "pacman" }
|
func (d pacman) Name() string { return "pacman" }
|
||||||
|
|
||||||
func (d Pacman) Fetch() error {
|
func (d pacman) Fetch() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Pacman) Upgrade() error {
|
func (d pacman) Upgrade() error {
|
||||||
err := exec.Command(d.Name(), "-Syu").Run()
|
err := exec.Command(d.Name(), "-Syu").Run()
|
||||||
exec.Command(d.Name(), "-Ru").Run()
|
exec.Command(d.Name(), "-Ru").Run()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Pacman) Install(_pkg string) error {
|
func (d pacman) Install(_pkg string) error {
|
||||||
err := exec.Command(d.Name(), "-S", _pkg).Run()
|
err := exec.Command(d.Name(), "-S", _pkg).Run()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Pacman) Remove(_pkg string) error {
|
func (d pacman) Remove(_pkg string) error {
|
||||||
err := exec.Command(d.Name(), "-R", _pkg).Run()
|
err := exec.Command(d.Name(), "-R", _pkg).Run()
|
||||||
exec.Command(d.Name(), "-Ru").Run()
|
exec.Command(d.Name(), "-Ru").Run()
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -4,22 +4,22 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Yum struct{}
|
type yum struct{}
|
||||||
|
|
||||||
func (d Yum) Name() string { return "yum" }
|
func (d yum) Name() string { return "yum" }
|
||||||
|
|
||||||
func (d Yum) Fetch() error {
|
func (d yum) Fetch() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Yum) Upgrade() error {
|
func (d yum) Upgrade() error {
|
||||||
return exec.Command(d.Name(), "update").Run()
|
return exec.Command(d.Name(), "update").Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Yum) Install(_pkg string) error {
|
func (d yum) Install(_pkg string) error {
|
||||||
return exec.Command(d.Name(), "install", _pkg).Run()
|
return exec.Command(d.Name(), "install", _pkg).Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Yum) Remove(_pkg string) error {
|
func (d yum) Remove(_pkg string) error {
|
||||||
return exec.Command(d.Name(), "remove", _pkg).Run()
|
return exec.Command(d.Name(), "remove", _pkg).Run()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue