How intoli/exodus works
Based on our analysis of the file tree and README, Exodus is a Python-based command-line tool designed to “relocate” Linux ELF binaries by bundling them together with all their runtime dependencies. In other words, the tool detects a binary’s shared library requirements, collects these files (and optionally extra files specified by the user), and then creates a bundle that includes a specially generated launcher (either a compiled binary or a shell script) that correctly sets up the runtime environment for the relocated executable.
Main Components
• Command-Line Interface (CLI):
• The entry point is the CLI (src/exodus_bundler/cli.py) which parses input arguments (binaries to bundle, extra files, and options like --detect or --tarball).
• Bundling/Packaging Engine:
• The “bundling” module (src/exodus_bundler/bundling.py) orchestrates collecting the target binary and its runtime dependencies.
• Dependency Detection:
• The dependency_detection.py module identifies all shared libraries by invoking the dynamic linker (using LD_TRACE_LOADED_OBJECTS) and maybe by leveraging additional data (like strace outputs when requested).
• Input Parsing:
• The input_parsing.py module helps interpret user arguments (files, renames, and additional files to include).
• Templating & Launcher Generation:
• The templating.py module and the templates folder are responsible for generating the launcher scripts or even compiling a small statically linked launcher (by interfacing with gcc and libraries like musl or diet libc if available). The launcher handles overriding the hardcoded RPATH/linker path so that the bundled binary executes using the bundled dependencies.
• Output Bundling:
• The final product is either a self-extracting installation script or a tarball (if the --tarball flag is provided). The bundle is organized into the “bin”, “bundles”, and “data” directories. “data” holds actual file assets (named by SHA-256 hash), “bundles” mirrors the original filesystem structure via symlinks, and “bin” provides user-friendly entry point symlinks.
Interactions and Data Flow
• The CLI then passes the request to the bundling engine.
• The dependency detection module is called next to analyze the binary and, if necessary, extra files provided (including possibly through an automatic detection via the system package manager or using strace output).
• The templating module constructs the launcher(s) with necessary parameters (setting library search paths and the relocated linker).
• The bundler then creates the bundled directory structure (data, bundles, bin) and populates it with symlinks to actual files, using hashed names to prevent conflicts.
• Finally, the output is either emitted directly (for piping into an SSH process) or written to a tarball file.
Architectural Patterns and Technologies
• Modular Structure – Separation between CLI, dependency detection, launchers generation, and output bundling shows a clear separation of concerns.
• Template-Based Code Generation – The templating strategy is used to generate both shell-script and compiled launcher binaries.
• Integration of Native Tools – The tool interfaces with system utilities (ld-linux, strace) and optionally uses GCC and alternative libc implementations.
• Test Suite – The “tests” directory emphasizes an automated test setup using pytest and tox, which supports good development practices.