fix: insert autoinstall params before --- in GRUB kernel line

This commit is contained in:
Jino Jose 2026-06-24 13:17:55 +05:30
parent 1991307903
commit 1334a97dbc

View File

@ -64,9 +64,11 @@ cp "$GRUB_CFG" "$GRUB_CFG.orig"
sed -i "s/set timeout=.*/set timeout=5/" "$GRUB_CFG"
sed -i "s/set timeout_style=.*/set timeout_style=countdown/" "$GRUB_CFG"
# Add autoinstall params to the first linux kernel line
# Note: semicolon must be backslash-escaped in GRUB or it's treated as command separator
sed -i "/^\s*linux.*vmlinuz/s/$/ autoinstall ds=nocloud\\;s=\/cdrom\/nocloud\//" "$GRUB_CFG"
# Add autoinstall params BEFORE the '---' separator on the kernel line.
# Anything after '---' in a GRUB linux line goes to init, not the kernel.
# So 'autoinstall' and 'ds=' must be inserted BEFORE '---'.
# Semicolon is backslash-escaped so GRUB doesn't treat it as a command separator.
sed -i "/^\s*linux.*vmlinuz/s/---/autoinstall ds=nocloud\\;s=\/cdrom\/nocloud\/ ---/" "$GRUB_CFG"
echo "✓ GRUB patched"
# ── Extract MBR and EFI partition from original ISO ────