1
0

feat: add kernel install to distro interface

This commit is contained in:
2023-05-23 22:36:46 +00:00
parent daaef89050
commit e2d66db16f
7 changed files with 143 additions and 137 deletions

View File

@@ -1,6 +1,7 @@
package distro
import (
"errors"
"sync"
)
@@ -11,6 +12,7 @@ type distribution interface {
Distro() Distro
Equal(Distro) bool
Packages() (packages []string, err error)
Install(pkg string, headers bool) (err error)
Kernels() (kernels []KernelInfo, err error)
}
@@ -54,6 +56,17 @@ func (d Distro) Packages() (packages []string, err error) {
return
}
func (d Distro) Install(pkg string, headers bool) (err error) {
for _, dd := range distros {
if !dd.Equal(d) {
continue
}
return dd.Install(pkg, headers)
}
return errors.New("not found")
}
func (d Distro) Kernels() (kernels []KernelInfo, err error) {
for _, dd := range distros {
if dd.Equal(d) {