WIP: flatpak-export: Try to handle absolute symlinks from /usr/

Open Ludovico de Nittis requested to merge wip/flatpak_exports_for_run_host into main

If an host system uses absolute symlinks in /usr, if we just bind-mount the whole directory, these symlinks will be either broken or will point to an unexpected location.

For example Gentoo used to have a symlink /usr/lib with /usr/lib64 as a target.

If we notice an absolute symlink that points to /usr/*, we can convert it to a relative symlink to preserve its original target even inside the container.

Should fix #43

This is supposed to be sent upstream, but I preferred a quick review before sending this patch. Just to be sure that the approach that I used is the correct one.

AFAIK there shouldn't be files in /usr/, just directories and symlinks. If that's not the case, we should bind them too.

Merge request reports