Activate Proxmox auto-installer by bypassing file-existence gate in GRUB config
build-and-push / test (push) Successful in 35s
build-and-push / build-and-push (push) Successful in 1m9s

The auto-installer menuentry was wrapped in 'if [ -f auto-installer-mode.toml ]'
which never evaluated true. Replace the condition with 'if true' to activate the
built-in auto-installer entry, and only add the answer-url to kernel lines that
already have proxmox-start-auto-installer (rather than modifying the graphical
install entry).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-14 18:27:59 -04:00
parent 8b3b2e874a
commit 1bb6a44fc6
+15 -17
View File
@@ -109,42 +109,41 @@ func rewriteGrubConfig(original, answerURL string) string {
lines := strings.Split(original, "\n")
var result []string
depth := 0
firstMenuModified := false
for _, line := range lines {
trimmed := strings.TrimSpace(line)
// Strip comments to reclaim space for added kernel parameters
if strings.HasPrefix(trimmed, "#") {
continue
}
// Activate auto-installer mode by bypassing the file-existence check
if strings.Contains(line, "auto-installer-mode.toml") {
if strings.Contains(line, "! -f") {
line = strings.Replace(line, "[ ! -f auto-installer-mode.toml ]", "false", 1)
} else {
line = strings.Replace(line, "[ -f auto-installer-mode.toml ]", "true", 1)
}
trimmed = strings.TrimSpace(line)
}
if strings.HasPrefix(trimmed, "set timeout=") {
result = append(result, "set timeout=0")
continue
}
if strings.HasPrefix(trimmed, "set default=") {
result = append(result, "set default=0")
continue
}
if strings.HasPrefix(trimmed, "menuentry") {
depth++
}
if trimmed == "}" && depth > 0 {
if depth == 1 {
firstMenuModified = true
}
depth--
}
if depth > 0 && !firstMenuModified &&
(strings.HasPrefix(trimmed, "linux ") || strings.HasPrefix(trimmed, "linux\t")) {
if !strings.Contains(line, "proxmox-start-auto-installer") {
line = strings.TrimRight(line, " \t") + " proxmox-start-auto-installer"
}
if answerURL != "" && !strings.Contains(line, "proxmox-auto-installer-answer-url") {
line += " proxmox-auto-installer-answer-url=" + answerURL
// Add answer URL to kernel lines that already have proxmox-start-auto-installer
if depth > 0 && (strings.HasPrefix(trimmed, "linux ") || strings.HasPrefix(trimmed, "linux\t")) {
if strings.Contains(line, "proxmox-start-auto-installer") &&
answerURL != "" && !strings.Contains(line, "proxmox-auto-installer-answer-url") {
line = strings.TrimRight(line, " \t") + " proxmox-auto-installer-answer-url=" + answerURL
}
}
@@ -152,7 +151,6 @@ func rewriteGrubConfig(original, answerURL string) string {
result = append(result, line)
}
// Collapse consecutive blank lines
var collapsed []string
prevBlank := false
for _, line := range result {