Comment 5 for bug 1877491

Revision history for this message
Matthew Ruffell (mruffell) wrote : Re: cc_grub_dpkg: determine idevs in a more robust manner with grub-mkdevicemap

Hi Dimitri!

Thanks for your feedback! I have taken it on-board and pushed a new revision to the merge request.

grub-mkdevicemap has been removed in favour of grub-probe.

The fork for BIOS or EFI systems has been completely removed, and the code simplified.

The new code closely follows the algorithm from the usable_partitions(), device_to_id() and available_ids() functions in the grub2 debian/postinst.in script: https://paste.ubuntu.com/p/vKFNSwNyhP/

In short:

1) Fetch the disk the /boot directory is located on with grub-probe
2) If /dev/disk/by-id/ exists, create a mapping of /dev/disk/by-id values to devices.
3) Resolve the symlink from each /dev/disk/by-id value to find the one that matches the disk from 1).
4) If there is no /dev/disk/by-id value, fallback to the plain device name.

Please review and let me know what you think.