b1eab33b78
sanboot makes the ISO visible to UEFI but invisible to the Linux kernel after ExitBootServices(). Switch to direct kernel/initrd boot with a small CPIO overlay containing /pxe-init — a shell script that loads NIC drivers, configures DHCP, downloads the ISO via wget, and creates a loop device before handing off to the Proxmox installer init. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
28 lines
881 B
Go
28 lines
881 B
Go
package pxe
|
|
|
|
import (
|
|
"fmt"
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
"provisioning/internal/model"
|
|
)
|
|
|
|
func BuildIPXEScript(publicURL string, img *model.Image, mac string) string {
|
|
base := fmt.Sprintf("%s/images/boot", publicURL)
|
|
kernelURL := fmt.Sprintf("%s/%s", base, img.KernelPath)
|
|
initrdURL := fmt.Sprintf("%s/%s", base, img.InitrdPath)
|
|
isoURL := fmt.Sprintf("%s/%s", base, img.ISOPath)
|
|
overlayURL := fmt.Sprintf("%s/%s/pxe-overlay.img", base,
|
|
strings.Split(filepath.ToSlash(img.KernelPath), "/")[0])
|
|
answerURL := fmt.Sprintf("%s/api/boot/auto-answer", publicURL)
|
|
|
|
return fmt.Sprintf(`#!ipxe
|
|
echo Provisioning: booting %s on ${mac}
|
|
kernel %s ro ramdisk_size=16777216 rw quiet splash=silent proxmox-start-auto-installer proxmox-auto-installer-answer-url=%s prov.iso=%s rdinit=/pxe-init
|
|
initrd %s
|
|
initrd %s
|
|
boot
|
|
`, img.Name, kernelURL, answerURL, isoURL, initrdURL, overlayURL)
|
|
}
|