Setup kernel support

This commit is contained in:
Gregory Kurtzer
2020-11-18 21:52:03 -08:00
parent 0bc53ea483
commit 724e1de14c
12 changed files with 253 additions and 13 deletions

View File

@@ -0,0 +1,55 @@
package build
import (
"github.com/hpcng/warewulf/internal/pkg/assets"
"github.com/hpcng/warewulf/internal/pkg/kernel"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/spf13/cobra"
"os"
)
func CobraRunE(cmd *cobra.Command, args []string) error {
var nodes []assets.NodeInfo
set := make(map[string]int)
if len(args) == 1 && ByNode == true {
var err error
nodes, err = assets.SearchByName(args[0])
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not find nodes for search term: %s\n", args[0])
os.Exit(1)
}
for _, node := range nodes {
set[node.KernelVersion] ++
}
} else if BuildAll == true {
var err error
nodes, err = assets.FindAllNodes()
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not get list of nodes: %s\n", err)
os.Exit(1)
}
for _, node := range nodes {
set[node.KernelVersion] ++
}
} else if len(args) == 1 {
set[args[0]] ++
} else {
cmd.Usage()
os.Exit(1)
}
for k := range set {
err := kernel.Build(k)
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
}
return nil
}