Documentation
¶
Overview ¶
Snag a copy of a binary and all its dependencies to DESTINATION/bin & DESTINATION/lib64
Snaggle is designed to help create minimal runtime containers from pre-existing installations. It may work for other use cases and I'd be interested to hear about them at: https://github.com/MusicalNinjaDad/snaggle
Usage:
snaggle [--in-place] FILE DESTINATION snaggle [--copy | --in-place] [--recursive] DIRECTORY DESTINATION
Flags:
--copy Copy entire directory contents to /DESTINATION/full/source/path
-h, --help help for snaggle
--in-place Snag in place: only snag dependencies & interpreter
-r, --recursive Recurse subdirectories & snag everything
-v, --verbose Output to stdout and process sequentially for readability
--version version for snaggle
In the form "snaggle FILE DESTINATION":
FILE and all dependencies will be snagged to DESTINATION. An error will be returned if FILE is not a valid ELF binary.
In the form "snaggle DIRECTORY DESTINATION":
All valid ELF binaries in DIRECTORY, and all their dependencies, will be snagged to DESTINATION.
Snaggle will hardlink (or copy, see notes): - Executables -> DESTINATION/bin - Dynamic libraries (*.so) -> DESTINATION/lib64
Notes:
- Follows symlinks
- Hardlinks will be created if possible.
- A copy will be performed if hardlinking fails for one of the following reasons: FILE/DIRECTORY & DESTINATION are on different filesystems or the user does not have permission to hardlink (e.g. https://docs.kernel.org/admin-guide/sysctl/fs.html#protected-hardlinks)
- Copies will retain the original filemode
- Copies will attempt to retain the original ownership, although this will likely fail if running as non-root
- Running with --verbose will be slower, not only due to processing stdout, but also as each file will be processed sequentially to provide readable output. Running silently will process all files and dependencies in parallel.
Exit Codes:
0: Success 1: Error 2: Invalid command 3: Panic
Click to show internal directories.
Click to hide internal directories.