Once again, I have a difficult-to-name module.
Given a fully installed Linux (or BSD?) file tree, this module lets you select the files, directories, symlinks, device nodes, etc which you want to become part of a reduced system image. The purpose is to generate Linux initrd, or docker images, or portable chroots, or embedded system images. The cool features are:
- It inspects the 'ldd' output on ELF binaries to determine which libs need added
- It preserves permissions and mtimes of files and the directories that contain them (unlike mkdir -p)
- It can move executables to new locations (like moving them to /newprefix/bin/)
- It can rewrite interpreter paths of scripts to match their new location
- It can rewrite the lib paths of ELF files so that they can live alongside an incompatible libc ecosystem
I'm actually not even sure it belongs on CPAN, because while I keep writing code like this, it's always fairly specialized and I have no idea if my hacks and special cases will be useful for a different environment.
I'm leaning toward "Linux::SystemSlicer" (i.e. like a slice of an array) but other phrases that come to mind are "Filesystem Subset Extractor", "Root Image Collector", "Initrd Builder", or "System Minifier". I'm only planning to ever use it on Linux, but I think it could theoretically be applied to BSD? There are probably a huge number of additional special cases that would be needed for anything other than Linux.