Add automated PXE installation via ISO GRUB modification and auto-answer endpoint
build-and-push / test (push) Successful in 35s
build-and-push / build-and-push (push) Successful in 1m20s

Modifies uploaded ISO's GRUB config in-place to set timeout=0 and inject
proxmox-start-auto-installer + answer-url kernel params, enabling fully
hands-off installation. Adds /api/boot/auto-answer endpoint that identifies
hosts by ARP-resolving the requester's IP to MAC address.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-14 14:28:10 -04:00
parent 994152bedf
commit f58ab9fab3
6 changed files with 257 additions and 14 deletions
+18 -2
View File
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io"
"log"
"os"
"path/filepath"
"regexp"
@@ -13,8 +14,9 @@ import (
)
type Service struct {
Store *store.Images
ImageDir string
Store *store.Images
ImageDir string
PublicURL string
}
type UploadParams struct {
@@ -53,6 +55,20 @@ func (s *Service) Upload(ctx context.Context, p UploadParams) (*model.Image, err
return nil, fmt.Errorf("extract ISO: %w", err)
}
if s.PublicURL != "" {
report := func(stage, detail string) {
if p.OnProgress != nil {
p.OnProgress(stage, detail)
}
}
report("packaging", "Configuring ISO for automated installation...")
isoFile := filepath.Join(destDir, result.ISOFilename)
answerURL := s.PublicURL + "/api/boot/auto-answer"
if err := ModifyISOForAutoInstall(isoFile, answerURL); err != nil {
log.Printf("image: ISO auto-install modification failed (non-fatal): %v", err)
}
}
kernelPath := filepath.Join(p.Name, result.KernelFilename)
initrdPath := filepath.Join(p.Name, result.InitrdFilename)
isoPath := filepath.Join(p.Name, result.ISOFilename)