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 (
|
import (
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
|
|
||||||
"github.com/hpcng/warewulf/internal/pkg/util"
|
"github.com/hpcng/warewulf/internal/pkg/util"
|
||||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||||
@@ -30,6 +31,11 @@ func KernelFind(container string) string {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sort.Slice(kernelPaths, func(i, j int) bool {
|
||||||
|
return kernelPaths[i] > kernelPaths[j]
|
||||||
|
})
|
||||||
|
|
||||||
for _, kernelPath := range kernelPaths {
|
for _, kernelPath := range kernelPaths {
|
||||||
wwlog.Printf(wwlog.DEBUG, "Checking for kernel path: %s\n", kernelPath)
|
wwlog.Printf(wwlog.DEBUG, "Checking for kernel path: %s\n", kernelPath)
|
||||||
if util.IsFile(kernelPath) {
|
if util.IsFile(kernelPath) {
|
||||||
|
|||||||
Reference in New Issue
Block a user