From b475cb2ea3d36a1692b42fa656398d68d6615cb9 Mon Sep 17 00:00:00 2001 From: Alex Crawford Date: Mon, 31 Aug 2015 23:02:25 -0700 Subject: [PATCH] grub: run Ignition on first boot --- build_library/grub.cfg | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/build_library/grub.cfg b/build_library/grub.cfg index e9120b718a..b1be733f33 100644 --- a/build_library/grub.cfg +++ b/build_library/grub.cfg @@ -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 }