use grub/shim from host system

Also the boot method is now configured globaly as this is
the only way to make sure that unkonwn nodes get the right
stuff

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2023-10-12 14:57:23 +02:00
committed by Jonathon Anderson
parent 938eff2cfa
commit 4379c4c18d
18 changed files with 135 additions and 125 deletions

View File

@@ -1,12 +1,12 @@
package configure
import (
"fmt"
"os"
"path"
warewulfconf "github.com/hpcng/warewulf/internal/pkg/config"
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/warewulfd"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
)
@@ -20,28 +20,34 @@ func TFTP() error {
return err
}
fmt.Printf("Writing PXE files to: %s\n", tftpdir)
copyCheck := make(map[string]bool)
for _, f := range controller.TFTP.IpxeBinaries {
if !path.IsAbs(f) {
f = path.Join(controller.Paths.Ipxesource, f)
}
if copyCheck[f] {
continue
}
copyCheck[f] = true
err = util.SafeCopyFile(f, path.Join(tftpdir, path.Base(f)))
if controller.Warewulf.GrubBoot {
err := warewulfd.CopyShimGrub()
if err != nil {
wwlog.Warn("ipxe binary could not be copied, booting may not work: %s", err)
wwlog.Warn("error when copying shim/grub binaries: %s", err)
}
} else {
wwlog.Info("Writing PXE files to: %s", tftpdir)
copyCheck := make(map[string]bool)
for _, f := range controller.TFTP.IpxeBinaries {
if !path.IsAbs(f) {
f = path.Join(controller.Paths.Ipxesource, f)
}
if copyCheck[f] {
continue
}
copyCheck[f] = true
err = util.SafeCopyFile(f, path.Join(tftpdir, path.Base(f)))
if err != nil {
wwlog.Warn("ipxe binary could not be copied, booting may not work: %s", err)
}
}
}
if !controller.TFTP.Enabled {
wwlog.Info("Warewulf does not auto start TFTP services due to disable by warewulf.conf")
os.Exit(0)
}
fmt.Printf("Enabling and restarting the TFTP services\n")
wwlog.Info("Enabling and restarting the TFTP services")
err = util.SystemdStart(controller.TFTP.SystemdName)
if err != nil {
wwlog.Error("%s", err)