Fix replacing symlink with a directory when obsoleting gnu-efi-compat (rhbz#2273530)
In gnu-efi-compat (an obsoleted package), /usr/include/efi/x86_64 was a
symlink to a directory, which has been replaced by an actual directory
in gnu-efi-devel. rpm doesn't handle symlink replacement with a
directory and reports this as a file conflict:
Error: Transaction test error:
file /usr/include/efi/x86_64 from install of gnu-efi-devel-1:3.0.18-2.fc39.x86_64 conflicts with file from package gnu-efi-compat-1:3.0.11-10.fc37.x86_64
$ ls -l /usr/include/efi/x86_64
lrwxrwxrwx 1 root root 4 Jul 21 2022 /usr/include/efi/x86_64 -> x64/
To fix this, we need to remove the symlink before the transaction
starts. The lua scriptlet that does this is copied from Fedora packaging
guidelines, https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement/https://bugzilla.redhat.com/show_bug.cgi?id=2273530