|
1 | 1 | # Main GRUB config
|
2 | 2 |
|
| 3 | +# dump vars as they are when grub loads this config |
| 4 | +set |
| 5 | + |
| 6 | +# figure out the root |
| 7 | +if [ "$grub_platform" = "efi" ]; then |
| 8 | + if [ -e "($cmddevice)/isolinux/efi.img" ]; then |
| 9 | + set isoboot="1" |
| 10 | + fi |
| 11 | + |
| 12 | + # on efi, $cmddevice has the disk grub was invoked from. |
| 13 | + set root="$cmddevice" |
| 14 | +else |
| 15 | + search --fs-uuid @@ESP_FSID@@ --set root --hint "$root" |
| 16 | +fi |
| 17 | + |
3 | 18 | # Set the prefix back to the correct value after we're done with memdisk
|
4 | 19 | set prefix=($root)/coreos/grub
|
5 | 20 |
|
@@ -57,23 +72,25 @@ if [ "$net_default_server" != "" ]; then
|
57 | 72 | fi
|
58 | 73 |
|
59 | 74 | # Search for the OEM partition, load additional configuration if found.
|
60 |
| -if [ "$secure_boot" = "0" ]; then |
| 75 | +if [ "$secure_boot" = "0" -a -z "$isoboot" ]; then |
61 | 76 | search --no-floppy --set oem --part-label OEM --hint "$root"
|
62 | 77 | if [ -n "$oem" -a -f "($oem)/grub.cfg" ]; then
|
63 | 78 | source "($oem)/grub.cfg"
|
64 | 79 | fi
|
65 | 80 | fi
|
66 | 81 |
|
67 | 82 | # Determine if this is a first boot.
|
68 |
| -search --no-floppy --set first_boot \ |
69 |
| - --disk-uuid 00000000-0000-0000-0000-000000000001 |
70 |
| -if [ -n "$first_boot" ]; then |
71 |
| - # Note we explicitly request the disk-guid randomization, first_boot only triggers ignition. |
72 |
| - set first_boot="coreos.first_boot=1 coreos.randomize_disk_guid=00000000-0000-0000-0000-000000000001" |
73 |
| -fi |
74 |
| - |
75 |
| -if [ -n "$oem_id" ]; then |
76 |
| - set oem_id="coreos.oem.id=$oem_id" |
| 83 | +if [ -z "$isoboot" ]; then |
| 84 | + search --no-floppy --set first_boot \ |
| 85 | + --disk-uuid 00000000-0000-0000-0000-000000000001 |
| 86 | + if [ -n "$first_boot" ]; then |
| 87 | + # Note we explicitly request the disk-guid randomization, first_boot only triggers ignition. |
| 88 | + set first_boot="coreos.first_boot=1 coreos.randomize_disk_guid=00000000-0000-0000-0000-000000000001" |
| 89 | + fi |
| 90 | + |
| 91 | + if [ -n "$oem_id" ]; then |
| 92 | + set oem_id="coreos.oem.id=$oem_id" |
| 93 | + fi |
77 | 94 | fi
|
78 | 95 |
|
79 | 96 | # If no specific console has been set by the OEM then select based on
|
|
107 | 124 | # Assemble the options applicable to all the kernels below
|
108 | 125 | set linux_cmdline="rootflags=rw mount.usrflags=ro consoleblank=0 $linux_root $linux_console $first_boot $oem_id $linux_append"
|
109 | 126 |
|
110 |
| -menuentry "CoreOS default" --id=coreos { |
111 |
| - gptprio.next -d usr -u usr_uuid |
112 |
| - if [ "$usr_uuid" = "7130c94a-213a-4e5a-8e26-6cce9662f132" ]; then |
113 |
| - linux$suf /coreos/vmlinuz-a @@MOUNTUSR@@=PARTUUID=$usr_uuid $linux_cmdline |
114 |
| - else |
115 |
| - linux$suf /coreos/vmlinuz-b @@MOUNTUSR@@=PARTUUID=$usr_uuid $linux_cmdline |
116 |
| - fi |
117 |
| -} |
118 |
| - |
119 |
| -menuentry "CoreOS USR-A" --id=coreos-a { |
120 |
| - linux$suf /coreos/vmlinuz-a @@MOUNTUSR@@=PARTLABEL=USR-A $linux_cmdline |
121 |
| -} |
| 127 | +if [ -z "$isoboot" ]; then |
| 128 | + menuentry "CoreOS default" --id=coreos { |
| 129 | + gptprio.next -d usr -u usr_uuid |
| 130 | + if [ "$usr_uuid" = "7130c94a-213a-4e5a-8e26-6cce9662f132" ]; then |
| 131 | + linux$suf /coreos/vmlinuz-a @@MOUNTUSR@@=PARTUUID=$usr_uuid $linux_cmdline |
| 132 | + else |
| 133 | + linux$suf /coreos/vmlinuz-b @@MOUNTUSR@@=PARTUUID=$usr_uuid $linux_cmdline |
| 134 | + fi |
| 135 | + } |
| 136 | + |
| 137 | + menuentry "CoreOS USR-A" --id=coreos-a { |
| 138 | + linux$suf /coreos/vmlinuz-a @@MOUNTUSR@@=PARTLABEL=USR-A $linux_cmdline |
| 139 | + } |
| 140 | + |
| 141 | + menuentry "CoreOS USR-B" --id=coreos-b { |
| 142 | + linux$suf /coreos/vmlinuz-b @@MOUNTUSR@@=PARTLABEL=USR-B $linux_cmdline |
| 143 | + } |
| 144 | +else |
| 145 | + menuentry "CoreOS default" --id=coreos { |
| 146 | + linux$suf /coreos/vmlinuz coreos.autologin= $linux_console |
| 147 | + initrd$suf /coreos/cpio.gz |
| 148 | + } |
| 149 | +fi |
122 | 150 |
|
123 |
| -menuentry "CoreOS USR-B" --id=coreos-b { |
124 |
| - linux$suf /coreos/vmlinuz-b @@MOUNTUSR@@=PARTLABEL=USR-B $linux_cmdline |
125 |
| -} |
|
0 commit comments