dissect: implement the same logic as gpt-auto-generator
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 24 May 2023 14:55:16 +0000 (16:55 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 29 May 2023 22:21:44 +0000 (00:21 +0200)
commit1d96dae716bd16e888f288e2799792c55644c48d
tree790d001942ff093457387476bf7c706755e292f8
parent6a488fa7cce8124fa885adf8a2f31363fe62f636
dissect: implement the same logic as gpt-auto-generator

gpt-auto-generator does three checks: 1. whether the directory doesn't have
files, 2. whether it's not in fstab, and 3. whether it is not a mount point.
For dissect logic, 3. is not relevant, and it ignores 2.
But the check whether files exists was done only partially: it was done
for /efi, but not for /boot.

Two changes are made:
- the check whether /boot is empty is now done.
- for ESP, /boot is used in preference to /efi, if not used for XBOOTLDR.

With those changes, the logic in dissect matches what gpt-auto-generator does.
There are the two intentional differences described in the first paragraph,
src/shared/dissect-image.c