Install-If Triggers
Install-if is a conditional installation mechanism specific to Alpine Linux. A package can declare trigger conditions that cause it to be automatically installed when all conditions are met.
Format
The i: field in the APKINDEX lists one or more trigger package names:
This means: install gdk-pixbuf-loader-svg automatically if both gdk-pixbuf and librsvg are present in the resolved set. The conditions use AND semantics — every trigger must be satisfied.
Use cases
Alpine uses install-if for packages that bridge two libraries:
- Image format loaders —
gdk-pixbuf-loader-svgis installed when both the pixbuf framework and the SVG library are present - GTK input methods — installed when both GTK and the input method library are present
- Font rendering backends — installed when both fontconfig and the specific renderer are present
Without install-if, these bridge packages would either need to be hard dependencies of one side (pulling in the other unnecessarily) or manually requested by the user.
Evaluation
Install-if triggers are evaluated in a fixpoint loop after both the main BFS resolution and the RPM rich dependency evaluation complete:
- Scan every package in the index that has install-if conditions
- For each, check if ALL conditions are satisfied by the current resolved set
- If all conditions are met and the package isn't already installed, add it and resolve its hard dependencies
- Repeat until no new packages are triggered
The loop runs last because: - The main BFS must complete first so the resolved set is populated - Rich dependency evaluation may add packages that satisfy install-if conditions - Installing an install-if triggered package may satisfy conditions for another triggered package
Version constraints
Install-if conditions can include version constraints:
FlatRoot strips the version constraints during parsing and checks only whether the named package is present. This is consistent with Alpine's behavior — the version constraint is a hint, not a hard requirement for triggering.
Related pages
- Appendix / Dependencies / Alternative Dependencies — An alternative dependency can be satisfied by any one of several packages. The resolver tries each option in order and picks the first that exists and satisfies any version...
appendix dependencies resolver - Appendix / Dependencies / BFS Traversal — Depth-first search (DFS) would also visit every reachable package, but BFS has two properties flatroot relies on:
appendix dependencies resolver - Appendix / Dependencies / Rich Dependencies — Rich dependencies are boolean expressions used in RPM-based distributions (CentOS, Fedora, AlmaLinux, Rocky, openSUSE) to encode conditional, alternative, and conjunctive...
appendix dependencies resolver