pub fn build_repo_apply_bundle(
repos: &ReposConfFile,
main_pacman_text: &str,
selected_section: &str,
) -> Result<RepoApplyBundle, String>Expand description
What: Build privileged commands to apply enabled [[repo]] rows from repos.conf.
Inputs:
repos: Parsed document.main_pacman_text: Current contents of the mainpacman.conf(read from disk by the caller).selected_section:[repo]name for the focused modal row (trimmed; case-insensitive). The matching[[repo]]must declare apply sources (server,mirrorlist, orhttp/httpsmirrorlist_url), even whenenabled = false.
Output:
RepoApplyBundleor an actionable error string.
Details:
- Regenerates the entire managed drop-in from all enabled rows that define
server, localmirrorlist, ormirrorlist_url(http/https). When none are enabled, writes a short comment-only stub file. - Optionally downloads
mirrorlist_urltargets with curl (privileged) before writing the drop-in. - Runs
pacman-key --recv-keys(with optional--keyserverfromkey_server) /--lsign-keyfor each distinct fingerprint whenkey_idparses to at least 8 hex digits. - Appends the managed
Includeblock only if an active (uncommented)PACMAN_MANAGED_BEGINline is absent. - Appends
pacman -Sy --noconfirmafter repo files are updated. - Uses
active_toolfor privilege wrapping; fails if no tool is configured.
ยงErrors
- When
active_toolreturns an error (no privilege tool configured). - When [
build_repo_apply_bundle_with_tool] rejects the plan (bad selection, unsafe paths, invalid stanzas).