Increase portability of tmpfs implementation to support BSDs
Per Issue #344, this increases portability to BSDs (tmpfs implementation only, of course). Specifically, the following are addressed:
- Doesn't hard-code path to
bash - Use
rminstead of non-portableunlink - Avoid use of non-portable options:
find's-printfcp's--reflink=automv's--no-target-directorypgrep's-c
- Only require
modinfoif using OverlayFS
These changes have been extracted from my own patches for an OpenBSD port (https://github.com/morgant/my-openbsd-ports/blob/main/www/profile-sync-daemon/patches/patch-common_profile-sync-daemon_in). As noted in Issue #344, there are some additional options that differ across implementations of du & stat, but I have left those changes out as there may still be some differences between BSDs that would be best applied as OS-specific patches. Similarly, OpenBSD's rsync port doesn't support the -X option since the file system doesn't support metadata, so that should remain as an OpenBSD-specific patch.
Not sure how I feel about this since I do not have any BSD boxes/VMs for testing... have you been running the modified code on BSD?
I have been running the modified code, but only under OpenBSD. I'd certainly prefer others running different BSDs and Linux distros confirm that this work there too.
To be honest, I wasn't sure what you'd think either and am not in a rush to have these changes merged. I mainly wanted to put the idea out there, with some suggested changes, as food for thought.
Edit: I'm happy to try to keep this PR updated as I maintain my OpenBSD port (though it hasn't been accepted into ports tree yet as there wasn't enough initial interest.)
OK, let's keep this open as you said. Thank for your work to bring it to other users.