Sort kernel paths to find the biggest version.
Note we can do better as this is an alpha sort, so 9 is always bigger than 10.
This commit is contained in:
@@ -3,6 +3,7 @@ package container
|
||||
import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
"github.com/hpcng/warewulf/internal/pkg/util"
|
||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||
@@ -30,6 +31,11 @@ func KernelFind(container string) string {
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
sort.Slice(kernelPaths, func(i, j int) bool {
|
||||
return kernelPaths[i] > kernelPaths[j]
|
||||
})
|
||||
|
||||
for _, kernelPath := range kernelPaths {
|
||||
wwlog.Printf(wwlog.DEBUG, "Checking for kernel path: %s\n", kernelPath)
|
||||
if util.IsFile(kernelPath) {
|
||||
|
||||
Reference in New Issue
Block a user