Today, I have an ISO that includes autoinstall, which installs my product foo. My userdaya.yml
looks something like the following -
#cloud-config
autoinstall:
version: 1
identity:
hostname: ubuntu-server
password: "XXX"
username: userfoobar
late-commands:
- cp -r /cdrom/copy_to_iso/ /target/opt/
user-data:
runcmd:
- |
mv -v /opt/copy_to_iso/foo_or_bar /opt/foo_or_bar
bash -x /opt/foo_or_bar/install.sh foo
As you might notice, I pass the parameter foo
to /opt/foo_or_bar/install.sh
, and this script installs my product foo. I am looking for a way to dynamically install foo or bar based on the parameter I pass to the script /opt/foo_or_bar/install.sh
. Where should I get the parameter from? From the grub menu, which today looks like this -
set timeout=30
loadfont unicode
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
menuentry "Ubuntu FOO" {
set gfxpayload=keep
linux /casper/vmlinuz autoinstall ds=nocloud\;s=/cdrom/nocloud/ ---
initrd /casper/initrd
}
grub_platform
if [ "$grub_platform" = "efi" ]; then
menuentry 'Boot from next volume' {
exit 1
}
menuentry 'UEFI Firmware Settings' {
fwsetup
}
else
menuentry 'Test memory' {
linux16 /boot/memtest86+.bin
}
fi
I wish to add something like this -
menuentry "Ubuntu BAR" {
set gfxpayload=keep
linux /casper/vmlinuz autoinstall ds=nocloud\;s=/cdrom/nocloud/ ---
initrd /casper/initrd
}
If the user selects this option in the menu, it will install (by install.sh
) bar, and not foo.
So my question is - is there a way to pass a parameter to autoinstall by the option selected in the grub menu?