SCAutolib.isDistro

This module provides a utility function, isDistro, designed to identify the operating system distribution and its version. This functionality helps SCAutolib to dynamically configure system settings or install packages based on the specific Linux distribution it’s running on.

Functions

isDistro(OSes, version=None)[source]

Identifies if the current operating system matches a specified distribution and, optionally, its version. This function leverages the distro library to determine the system’s ID, name, and version details.

Parameters:
  • OSes (Union[str, list]) – The ID or name of the operating system(s) to check against. Can be a single string (e.g., “fedora”, “rhel”) or a list of strings. Case-insensitive comparison is performed.

  • version (str, optional) – An optional string specifying the version to check. It can include comparison operators (<, <=, ==, >, >=). If no operator is specified, == is assumed. Examples: “8”, “>=9”, “<39”.

Returns:

True if the current operating system matches the specified distribution(s) and version criteria; False otherwise.

Return type:

bool