Principle:ARCANGEL0 EVA Package Management Abstraction
| Knowledge Sources | |
|---|---|
| Domains | System_Administration, Tool_Installation, Cross_Platform |
| Last Updated | 2026-10-29 14:00 GMT |
Overview
Abstraction for detecting and operating across heterogeneous Linux package managers — apt-get, pacman, dnf, zypper, apk, yum — with distro-aware preference, ecosystem install methods, and managed installation tracking.
Description
Linux distributions use different package managers (APT for Debian/Ubuntu, Pacman for Arch, DNF for Fedora, etc.). A package management abstraction layer:
- Detects the host environment: Reads `/etc/os-release` to identify the distribution and selects the preferred package manager.
- Queries package status: Uses distro-appropriate commands (`dpkg-query`, `pacman -Q`, `rpm -q`, `apk info`) to check if a package is installed.
- Generates install commands: Produces correct package manager invocations for install/uninstall operations.
- Supports ecosystem methods: Falls back to ecosystem installers (Go, Cargo, pipx, gem, git clone, official scripts) when native packages are unavailable.
- Tracks managed installs: Records which tools the framework installed and via which method, enabling clean uninstall.
This principle enables the framework to install 165+ security tools across any Linux distribution without hardcoding distro-specific logic into each tool definition.
Usage
Apply this principle when:
- Building cross-distribution tooling that needs to install or query packages.
- Supporting multiple install ecosystems (native packages, Go, Cargo, pipx, etc.).
- Needing to track and reverse managed installations.
- Detecting which package manager is available on an unknown host.
Theoretical Basis
The detection follows a preference-ordered search:
# Abstract algorithm (NOT real implementation)
def detect_host():
os_id = parse_os_release()["ID"]
preferred = DISTRO_PREFERENCES.get(os_id) # e.g., "ubuntu" -> "apt-get"
for manager in sort_by_preference(ALL_MANAGERS, preferred):
if shutil.which(manager):
return HostEnvironment(os_id, os_name, manager, ...)
return HostEnvironment(os_id, os_name, "", "Unavailable")
Install method selection tries native packages first, then ecosystem methods:
# Abstract algorithm (NOT real implementation)
def select_method(tool, environment):
if package_available(environment.manager, tool.packages[environment.manager]):
return f"system:{environment.manager}:{package}"
for method in tool.install_methods:
if method_runtime_available(method):
return method.id
raise NoInstallSourceError
Practical Guide
- Read `/etc/os-release` for distro identification — it's the Linux Standard Base.
- Order managers by distro preference so the right one is tried first.
- Generate shell scripts, not direct commands — the operator sees and approves the full script.
- Report privileged commands separately for operator transparency (sudo requirements).
- Track managed installs in a JSON registry so uninstall is safe and verified.
- Verify ownership before uninstalling source-based installs (check a marker file).
Related Pages
Implemented By
- Implementation:ARCANGEL0_EVA_detect_host_environment
- Implementation:ARCANGEL0_EVA_build_install_script
- Implementation:ARCANGEL0_EVA_open_install_terminal
- Implementation:ARCANGEL0_EVA_inspect_tool
- Implementation:ARCANGEL0_EVA_ToolSpec
- Implementation:ARCANGEL0_EVA_HostEnvironment