grub: run Ignition on first boot

This commit is contained in:
Alex Crawford 2015-08-31 23:02:25 -07:00
parent 0bc560d6ad
commit b475cb2ea3

View File

@ -11,9 +11,10 @@ insmod all_video
set default="coreos"
set timeout=1
# Default kernel args for root filesystem and console.
# Default kernel args for root filesystem, console, and Ignition.
set linux_root="root=LABEL=ROOT"
set linux_console=""
set ignition=""
# Anything else the OEM adds should use this variable.
set linux_append=""
@ -36,6 +37,13 @@ if [ "$secure_boot" = "0" ]; then
fi
fi
# Determine if this is a first boot. Run Ignition if so.
search --no-floppy --set first_boot \
--disk-uuid 00000000-0000-0000-0000-000000000001
if [ -n "$first_boot" ]; then
set ignition="coreos.ignition.run=1"
fi
# If no specific console has been set by the OEM then select based on
# platform, most systems use vga text as primary and ttyS0 as secondary.
if [ -z "$linux_console" ]; then
@ -61,20 +69,20 @@ fi
menuentry "CoreOS default" --id=coreos {
gptprio.next -d usr -u usr_uuid
if [ "$usr_uuid" = "7130c94a-213a-4e5a-8e26-6cce9662f132" ]; then
linux$suf /coreos/vmlinuz-a $linux_console $linux_root \
linux$suf /coreos/vmlinuz-a $ignition $linux_console $linux_root \
@@MOUNTUSR@@=PARTUUID=$usr_uuid $linux_append
else
linux$suf /coreos/vmlinuz-b $linux_console $linux_root \
linux$suf /coreos/vmlinuz-b $ignition $linux_console $linux_root \
@@MOUNTUSR@@=PARTUUID=$usr_uuid $linux_append
fi
}
menuentry "CoreOS USR-A" --id=coreos-a {
linux$suf /coreos/vmlinuz-a $linux_console $linux_root \
linux$suf /coreos/vmlinuz-a $ignition $linux_console $linux_root \
@@MOUNTUSR@@=PARTLABEL=USR-A $linux_append
}
menuentry "CoreOS USR-B" --id=coreos-b {
linux$suf /coreos/vmlinuz-b $linux_console $linux_root \
linux$suf /coreos/vmlinuz-b $ignition $linux_console $linux_root \
@@MOUNTUSR@@=PARTLABEL=USR-B $linux_append
}