Skip to content

Commit

Permalink
grub: support searching for boot by UUID
Browse files Browse the repository at this point in the history
This adds support for a `bootuuid.cfg` dropin sitting alongside both the
BIOS and EFI GRUB configs to specify the UUID to scan for instead of
relying on labels.

Part of coreos/fedora-coreos-tracker#976.
  • Loading branch information
jlebon committed Nov 22, 2021
1 parent a9d731b commit 394f9d2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/create_disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,14 @@ if [ -e (md/md-boot) ]; then
# the main grub.cfg.
set prefix=md/md-boot
else
search --label boot --set prefix --no-floppy
if [ -f ${config_directory}/bootuuid.cfg ]; then
source ${config_directory}/bootuuid.cfg
fi
if [ -n "${BOOT_UUID}" ]; then
search --fs-uuid "${BOOT_UUID}" --set prefix --no-floppy
else
search --label boot --set prefix --no-floppy
fi
fi
set prefix=($prefix)/grub2
configfile $prefix/grub.cfg
Expand Down
9 changes: 8 additions & 1 deletion src/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ if [ -d (md/md-boot)/grub2 ]; then
set boot=md/md-boot
set prefix=($boot)/grub2
else
search --label boot --set boot --no-floppy
if [ -f ${config_directory}/bootuuid.cfg ]; then
source ${config_directory}/bootuuid.cfg
fi
if [ -n "${BOOT_UUID}" ]; then
search --fs-uuid "${BOOT_UUID}" --set boot --no-floppy
else
search --label boot --set boot --no-floppy
fi
fi
set root=$boot

Expand Down

0 comments on commit 394f9d2

Please sign in to comment.