pub fn mirror_update_command(
countries: &str,
count: u16,
) -> Result<String, String>Expand description
What: Build a shell snippet to refresh pacman mirrors depending on the detected distro.
Inputs:
countries: Either “Worldwide” to auto-rank mirrors, or a comma-separated list used by the underlying toolcount: Mirror count used by Manjaro fasttrack whencountriesis “Worldwide”, or top mirrors number for Artix rate-mirrors
Output:
- Shell command string suitable to run in a terminal
Details:
- On Manjaro (detected via /etc/os-release), ensures pacman-mirrors exists, then:
- Worldwide:
pacman-mirrors --fasttrack {count} - Countries:
pacman-mirrors --method rank --country {countries_q}
- Worldwide:
- On
Artix(detected via /etc/os-release), checks for rate-mirrors andAURhelper (yay/paru), prompts for installation if needed, creates backup of mirrorlist, then runs rate-mirrors with country filtering using –entry-country option (only one country allowed, global option must come before the artix command). - On
EndeavourOS, ensureseos-rankmirrorsis installed, runs it, then runsreflector. - On
CachyOS, ensurescachyos-rate-mirrorsis installed, runs it, then runsreflector. - Otherwise, attempts to use
reflectorto write/etc/pacman.d/mirrorlist; if not found, prints a notice.
§Errors
Returns Err when the configured privilege tool cannot be resolved (see crate::logic::privilege::active_tool).