As part of a post-preseeding script, I want to disable ipv6.
In /etc/default/grub I want to change this line:
GRUB_CMDLINE_LINX=""
so that it reads:
GRUB_CMDLINE_LINUX="ipv6.disable=1"
Which can be done with:
sed -i "s/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"ipv6.disable=1\"/" /etc/default/grub
But sed won't match if GRUB_CMDLINE_LINUX already has arguments in it.
How can I add the parameter while preserving any existing arguments (if any) ?