Files
warewulf/etc/grub/grub.cfg.ww
Jonathon Anderson 45a690ca4e Rename "container" to "image"
- Updated `wwctl upgrade` to handle updates
- Maintained `.Container` and `.ContainerName` in tstruct
- Added `ContainerName()` methods to node and profile objects
- Added `--container`, `-C` aliases to wwctl commands (`<node|profile> <add|set>`)
- Added `wwctl container` alias
- Added support for `container_exit.sh` if `image_exit.sh` is not found

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2025-01-19 05:54:19 -07:00

99 lines
3.2 KiB
Plaintext

{{ if .ImageName }}
echo "================================================================================"
echo "Warewulf v4 now http booting grub: {{.Fqdn}} ({{.Hwaddr}})"
echo "================================================================================"
echo
echo "Warewulf Controller: {{.Ipaddr}}"
echo
sleep 1
smbios --type 3 --get-string 8 --set assetkey
uri="(http,{{.Ipaddr}}:{{.Port}})/provision/${net_default_mac}?assetkey=${assetkey}"
kernel="${uri}&stage=kernel"
image="${uri}&stage=image&compress=gz"
system="${uri}&stage=system&compress=gz"
runtime="${uri}&stage=runtime&compress=gz"
set default={{ or .Tags.GrubMenuEntry "ww4" }}
set timeout=5
menuentry "Network boot node: {{.Id}}" --id ww4 {
{{if .KernelVersion }}
echo "Kernel: {{.KernelVersion}}"
{{else}}
echo "Kernel: {{.ImageName}} (image default)"
{{end}}
echo "KernelArgs: {{.KernelArgs}}"
linux $kernel wwid=${net_default_mac} {{.KernelArgs}}
if [ x$? = x0 ] ; then
echo "Loading Image: {{.ImageName}}"
initrd $image $system $runtime
boot
else
echo "MESSAGE: This node seems to be unconfigured. Please have your system administrator add a"
echo " configuration for this node with HW address: ${net_default_mac}"
echo ""
echo "Rebooting in 1 minute..."
sleep 60
reboot
fi
}
menuentry "Network boot node with dracut: {{.Id}}" --id dracut {
initramfs="${uri}&stage=initramfs"
wwinit_uri="http://{{.Ipaddr}}:{{.Port}}/provision/${net_default_mac}"
{{if .KernelVersion }}
echo "Kernel: {{.KernelVersion}}"
{{else}}
echo "Kernel: {{.ImageName}} (image default)"
{{end}}
echo "KernelArgs: {{.KernelArgs}}"
net_args="rd.neednet=1 {{range $devname, $netdev := .NetDevs}}{{if and $netdev.Hwaddr $netdev.Device}} ifname={{$netdev.Device}}:{{$netdev.Hwaddr}} {{end}}{{end}}"
wwinit_args="root=wwinit wwinit.uri=${wwinit_uri}"
linux $kernel wwid=${net_default_mac} {{.KernelArgs}} $net_args $wwinit_args
if [ x$? = x0 ] ; then
echo "Loading Image: {{.ImageName}}"
initrd $initramfs
boot
else
echo "MESSAGE: This node seems to be unconfigured. Please have your system administrator add a"
echo " configuration for this node with HW address: ${net_default_mac}"
echo ""
echo "Rebooting in 1 minute..."
sleep 60
reboot
fi
}
menuentry "Chainload specific configfile" {
conf="(http,{{.Ipaddr}}:{{.Port}})/efiboot/grub.cfg?assetkey=${assetkey}"
configfile $conf
}
menuentry "UEFI Firmware Settings" --id "uefi-firmware" {
fwsetup
}
menuentry "System restart" {
echo "System rebooting..."
reboot
}
menuentry "System shutdown" {
echo "System shutting down..."
halt
}
{{ else }}
echo "================================================================================"
echo " Warewulf v4:"
echo " No node image defined for this node ({{.Fqdn}})."
echo " Rebooting in 30s."
echo "================================================================================"
sleep 30
reboot
{{ end }}