feat: add kernel install to distro interface
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user