Skip to main content

parse_os_release

Function parse_os_release 

Source
pub fn parse_os_release(contents: &str) -> LinuxDistro
Expand description

Identify the distribution family from the contents of /etc/os-release.

Reads the ID and ID_LIKE fields defined by the os-release specification rather than searching the file for distribution names. That distinction is the whole point: HOME_URL="https://example.org/research/" contains “arch”, and a substring search would call that machine Arch Linux and hand it pacman commands.

ID wins over ID_LIKE, so a derivative that names itself is taken at its word before its declared kinship is consulted.