Configure destination of grub.cfg at overlay render time
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -12,6 +12,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Change the DHCP server package used on openeuler 24.03 to dnsmasq
|
||||
- Added configurable Serial over LAN speed via IPMI `bit-rate` tag in `50-ipmi` template
|
||||
- Manage SELinux context of TFTP directory. #1997
|
||||
- Dynamically write `$tftpdir/warewulf/grub.cfg` to the configured value from `warewulf.conf`
|
||||
- Absolute paths specified with `{{ file }}` in an overlay now write to that absolute path.
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
1
Makefile
1
Makefile
@@ -204,7 +204,6 @@ install: build docs ## Install Warewulf from source
|
||||
for f in etc/ipxe/*.ipxe; do install -m 0644 $$f $(DESTDIR)$(WWCONFIGDIR)/ipxe/; done
|
||||
for f in lib/warewulf/bmc/*.tmpl; do install -m 0644 $$f $(DESTDIR)$(DATADIR)/warewulf/bmc; done
|
||||
install -m 0644 etc/grub/grub.cfg.ww $(DESTDIR)$(WWCONFIGDIR)/grub/grub.cfg.ww
|
||||
install -m 0644 etc/grub/chainload.ww $(DESTDIR)$(DATADIR)/warewulf/overlays/host/rootfs$(TFTPDIR)/warewulf/grub.cfg.ww
|
||||
install -m 0644 etc/logrotate.d/warewulfd.conf $(DESTDIR)$(LOGROTATEDIR)/warewulfd.conf
|
||||
(cd overlays && find * -path '*/internal' -prune -o -type f -exec install -D -m 0644 {} $(DESTDIR)$(DATADIR)/warewulf/overlays/{} \;)
|
||||
(cd overlays && find * -path '*/internal' -prune -o -type d -exec mkdir -pv $(DESTDIR)$(DATADIR)/warewulf/overlays/{} \;)
|
||||
|
||||
@@ -571,7 +571,20 @@ func BuildOverlayIndir(nodeData node.Node, allNodes []node.Node, overlayNames []
|
||||
}
|
||||
fileBuffer.Reset()
|
||||
}
|
||||
outputPath = path.Join(path.Dir(originalOutputPath), filenameFromTemplate[0][1])
|
||||
if path.IsAbs(filenameFromTemplate[0][1]) {
|
||||
outputPath = filenameFromTemplate[0][1]
|
||||
// Create parent directory for absolute paths
|
||||
parentDir := path.Dir(outputPath)
|
||||
sourceDirInfo, err := os.Stat(path.Dir(walkPath))
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not stat source directory: %w", err)
|
||||
}
|
||||
if err := os.MkdirAll(parentDir, sourceDirInfo.Mode()); err != nil {
|
||||
return fmt.Errorf("could not create parent directory for absolute path: %w", err)
|
||||
}
|
||||
} else {
|
||||
outputPath = path.Join(path.Dir(originalOutputPath), filenameFromTemplate[0][1])
|
||||
}
|
||||
writingToNamedFile = true
|
||||
isLink = false
|
||||
} else {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{{ file (print .Tftp.TftpRoot "/warewulf/grub.cfg") }}
|
||||
# This file is autogenerated by warewulf
|
||||
# Host: {{ .BuildHost }}
|
||||
# Time: {{ .BuildTime }}
|
||||
Reference in New Issue
Block a user