Is it possible to read the UUID of a partition into a variable in grub?

More specifically, I'm looking for the uuid of $root.

I have grub and couple of iso files on a flash on one partition, among
them arch linux. Grub loads fine. The relevant part of grub.cfg is

imgdevpath="/dev/disk/by-uuid/CF3D-EC7C"

menuentry '[loopback]archlinux-2015.07.01-dual.iso i686' {
    set isofile='/boot/iso/archlinux-2015.07.01-dual.iso'
    loopback loop $isofile
    linux (loop)/arch/boot/i686/vmlinuz archisolabel=ARCH_201507
img_dev=$imgdevpath img_loop=$isofile earlymodules=loop
    initrd (loop)/arch/boot/i686/archiso.img
}

This all works as intended - but it was necessary to set up the UUID
in imgdevpath by hand, which feels inconvenient and not really
necessary. I am able to read the UUID [among other things] with "ls
($root)" in grub interactively. Is there a way to read it to a
variable, at a boot time?

I.e. I'd like to have something like the following in grub.cfg:

readuuid ($root) --set=rootuuid
imgdevpath="/dev/disk/by-uuid/$rootuuid"
...

_______________________________________________
Help-grub mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-grub

Reply via email to