Support subdirectories in ipxe paths

Signed-off-by: Jonathon Anderson <janderson@ciq.co>
This commit is contained in:
Jonathon Anderson
2023-04-14 20:14:03 -06:00
parent e2e3a90623
commit 4622153a82
4 changed files with 4 additions and 3 deletions

View File

@@ -9,5 +9,5 @@ type TFTPConf struct {
SystemdName string `yaml:"systemd name" default:"tftp"`
// Path is relative to buildconfig.DATADIR()
IpxeBinaries map[string]string `yaml:"ipxe" default:"{\"00:09\": \"x86_64.efi\",\"00:00\": \"x86_64.kpxe\",\"00:0B\": \"arm64.efi\",\"00:07\": \"x86_64.efi\"}"`
IpxeBinaries map[string]string `yaml:"ipxe" default:"{\"00:09\": \"ipxe/ipxe-snponly-x86_64.efi\",\"00:00\": \"ipxe/undionly.kpxe\",\"00:0B\": \"ipxe/arm64-efi/snponly.efi\",\"00:07\": \"ipxe/ipxe-snponly-x86_64.efi\"}"`
}

View File

@@ -27,7 +27,7 @@ func TFTP() error {
continue
}
copyCheck[f] = true
err = util.SafeCopyFile(path.Join(controller.Paths.Datadir, f), path.Join(tftpdir, f))
err = util.SafeCopyFile(path.Join(controller.Paths.Datadir, f), path.Join(tftpdir, path.Base(f)))
if err != nil {
wwlog.Warn("ipxe binary could not be copied, booting may not work: %s", err)
}

View File

@@ -371,6 +371,7 @@ func RenderTemplateFile(fileName string, data TemplateStruct) (
"Include": templateFileInclude,
"IncludeFrom": templateContainerFileInclude,
"IncludeBlock": templateFileBlock,
"basename": path.Base,
"inc": func(i int) int { return i + 1 },
"dec": func(i int) int { return i - 1 },
"file": func(str string) string { return fmt.Sprintf("{{ /* file \"%s\" */ }}", str) },

View File

@@ -22,7 +22,7 @@ if exists user-class and option user-class = "iPXE" {
} else {
{{range $type,$name := $.Tftp.IpxeBinaries }}
if option architecture-type = {{ $type }} {
filename "/warewulf/{{ $name }}";
filename "/warewulf/{{ basename $name }}";
}
{{ end }}
}