copy_binaries: utility function to pick up a binary and needed libs
The existing multipath functionality manually picks up a binary and lots
of needed libraries manually, and sometimes misses libraries if the
binary was linked against something else.
Use lddtree from app-misc/pax-utils to get all libraries with the
binary. The only ones that will be missed are those that are dlopen()ed.
cpio is used for copying to preserve directory structure.
lddtree usage replaces a larger manual function from calling ldd, that
was also vulnerable to injections.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
(commit message rewritten)