Files
warewulf/etc/grub/grub.cfg.ww
Jonathon Anderson 0133a3eb46 Update dracut scripts, iPXE template, and GRUB config templates
- Update dracut scripts, iPXE template, and GRUB config templates to
  use new route paths and TLS-aware logic
- Minor troubleshooting doc cleanup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2026-03-19 09:08:25 +01:00

202 lines
5.1 KiB
Plaintext

echo
echo "Warewulf v4 (GRUB)"
echo
echo "Warewulf Server:"
echo "* Ipaddr: {{.Ipaddr}}"
echo "* Port: {{.Port}}"
echo "* Authority: {{.Authority}}"
echo
echo "This node:"
echo "* Fqdn: {{.Fqdn}}"
echo "* Hwaddr: {{.Hwaddr}}"
echo "* ImageName: {{.ImageName}}"
{{- if .KernelVersion }}
echo "* KernelVersion: {{.KernelVersion}}"
{{- else }}
echo "* KernelVersion: (image default)"
{{- end }}
echo "* KernelArgs: {{.KernelArgs}}"
{{- if not .ImageName }}
echo "!!"
echo "!! No image defined for {{.Fqdn}}."
echo "!! Rebooting in 30s...
echo "!!"
sleep 30
reboot
{{- end }}
echo "Reading asset key..."
smbios --type 3 --get-string 8 --set assetkey
base="(http,{{.Authority}})"
params="assetkey=${assetkey}"
kernel="${base}/kernel/${net_default_mac}?${params}"
set default={{ or .Tags.GrubMenuEntry "single-stage" }}
set timeout=2
menuentry "Single-stage boot" --id single-stage {
echo "Warewulf Server:"
echo "* Ipaddr: {{.Ipaddr}}"
echo "* Port: {{.Port}}"
echo
echo "This node:"
echo "* Fqdn: {{.Fqdn}}"
echo "* Hwaddr: {{.Hwaddr}}"
echo "* ImageName: {{.ImageName}}"
{{- if .KernelVersion }}
echo "* KernelVersion: {{.KernelVersion}}"
{{- else }}
echo "* KernelVersion: (image default)"
{{- end }}
echo "* KernelArgs: {{.KernelArgs}}"
echo
echo "Downloading kernel image..."
linux $kernel wwid=${net_default_mac} {{.KernelArgs}}
if [ $? != 0 ]
then
echo "!!"
echo "!! Unable to load kernel."
echo "!! Rebooting in 15s..."
echo "!!"
sleep 15
reboot
fi
echo "Downloading images..."
image="${base}/image/${net_default_mac}?${params}&compress=gz"
system="${base}/system/${net_default_mac}?${params}&compress=gz"
{{- if not (eq .TLS true) }}
runtime="${base}/runtime/${net_default_mac}?${params}&compress=gz"
{{- end }}
initrd $image $system $runtime
if [ $? != 0 ]
then
echo "!!"
echo "!! Unable to load images."
echo "!! Rebooting in 15s..."
echo "!!"
sleep 15
reboot
fi
echo "Booting..."
boot
}
menuentry "Single-stage boot (no compression)" --id single-stage-nocompress {
echo "Warewulf Server:"
echo "* Ipaddr: {{.Ipaddr}}"
echo "* Port: {{.Port}}"
echo
echo "This node:"
echo "* Fqdn: {{.Fqdn}}"
echo "* Hwaddr: {{.Hwaddr}}"
echo "* ImageName: {{.ImageName}}"
{{- if .KernelVersion }}
echo "* KernelVersion: {{.KernelVersion}}"
{{- else }}
echo "* KernelVersion: (image default)"
{{- end }}
echo "* KernelArgs: {{.KernelArgs}}"
echo
echo "Downloading kernel image..."
linux $kernel wwid=${net_default_mac} {{.KernelArgs}}
if [ $? != 0 ]
then
echo "!!"
echo "!! Unable to load kernel."
echo "!! Rebooting in 15s..."
echo "!!"
sleep 15
reboot
fi
echo "Downloading images..."
image="${base}/image/${net_default_mac}?${params}"
system="${base}/system/${net_default_mac}?${params}"
{{- if not (eq .TLS true) }}
runtime="${base}/runtime/${net_default_mac}?${params}"
{{- end }}
initrd $image $system $runtime
if [ $? != 0 ]
then
echo "!!"
echo "!! Unable to load images."
echo "!! Rebooting in 15s..."
echo "!!"
sleep 15
reboot
fi
echo "Booting..."
boot
}
menuentry "Two stage boot with dracut" --id dracut {
echo "Warewulf Server:"
echo "* Ipaddr: {{.Ipaddr}}"
echo "* Port: {{.Port}}"
echo
echo "This node:"
echo "* Fqdn: {{.Fqdn}}"
echo "* Hwaddr: {{.Hwaddr}}"
echo "* ImageName: {{.ImageName}}"
{{- if .KernelVersion }}
echo "* KernelVersion: {{.KernelVersion}}"
{{- else }}
echo "* KernelVersion: (image default)"
{{- end }}
echo "* KernelArgs: {{.KernelArgs}}"
initramfs="${base}/initramfs/${net_default_mac}?${params}"
wwinit_uri="http://{{.Ipaddr}}:{{.Port}}/provision/${net_default_mac}"
wwinit_server="http://{{.Ipaddr}}:{{.Port}}"
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:{{default "tmpfs" .Root}} wwinit.server=${wwinit_server} wwinit.uri=${wwinit_uri} init=/warewulf/run-init"
echo
echo "Downloading kernel image..."
linux $kernel wwid=${net_default_mac} {{.KernelArgs}} $net_args $wwinit_args
if [ $? != 0 ]
then
echo "!!"
echo "!! Unable to load kernel."
echo "!! Rebooting in 15s..."
echo "!!"
sleep 15
reboot
fi
echo "Downloading initramfs..."
initrd $initramfs
if [ $? != 0 ]
then
echo "!!"
echo "!! Unable to load initramfs."
echo "!! Rebooting in 15s..."
echo "!!"
sleep 15
reboot
fi
echo "Booting..."
boot
}
menuentry "UEFI Firmware Settings" --id "uefi-firmware" {
fwsetup
}
menuentry "System restart" {
echo "System rebooting..."
reboot
}
menuentry "System shutdown" {
echo "System shutting down..."
halt
}