Implementation:ARCANGEL0 EVA HostEnvironment
Appearance
| Knowledge Sources | |
|---|---|
| Domains | System_Administration, Cross_Platform |
| Last Updated | 2026-10-29 14:00 GMT |
Overview
Concrete data model and detection tool for host OS identification and native package manager discovery, provided by the Mitsu host environment module.
Description
The HostEnvironment dataclass captures the detected host environment:
- `os_id`: Lowercased distribution ID from `/etc/os-release` (e.g., "ubuntu", "arch", "kali").
- `os_name`: Human-readable OS name from `PRETTY_NAME` in `/etc/os-release`.
- `package_manager_id`: The detected package manager executable name (e.g., "apt-get", "pacman", "dnf").
- `package_manager_name`: Human-readable name (e.g., "APT", "Pacman").
- `package_manager_path`: Full path to the package manager binary.
The companion detect_host_environment function performs detection:
- Reads `/etc/os-release` for the distribution ID and name.
- Looks up the distro's preferred package manager from a hardcoded mapping (e.g., ubuntu→apt-get, arch→pacman).
- Searches package managers in preference order, returning the first found on PATH.
Usage
- Armory tool installation: Used by `inspect_tool` and `build_install_script` to determine which package manager to use.
- Docker installation: Used by `install_docker_engine` to detect the host's package manager.
- SearXNG setup: Used to determine the Docker runtime and group handling.
Code Reference
Source Location
- Repository: Mitsu
- File: services/host_environment.py
Signature
@dataclass(frozen=True)
class HostEnvironment:
os_id: str
os_name: str
package_manager_id: str
package_manager_name: str
package_manager_path: str
def detect_host_environment() -> HostEnvironment: ...
Import
from mitsu.services.host_environment import HostEnvironment, detect_host_environment
I/O Contract
Outputs
| Name | Type | Description |
|---|---|---|
| detect_host_environment() returns | HostEnvironment | Detected host OS and package manager |
Usage Examples
Detect Host Environment
from mitsu.services.host_environment import detect_host_environment
env = detect_host_environment()
print(f"OS: {env.os_name} ({env.os_id})")
print(f"Package manager: {env.package_manager_name} ({env.package_manager_id})")
print(f"Path: {env.package_manager_path}")
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment