This is the development version of Kanrisuru. Since this is still a pre-1.0 release, we don't recommend using this in system-critical production environments.

Kanrisuru

OS Family

The Kanrisuru::Util::OsFamily class helps resolve operating systems based on their family and upstream distribution sources.

An operating system is defined as having the following characteristics:

  • name: Name of the operating system
  • os_family: Collection of operating systems that the OS belongs to. Usually shares a common package management system, filesystem hierarchy, and other attributes that are similar in nature to other operating systems in the same family.
  • upstream: Some if not most operating systems are forked derivatives of an upstream operating system. This could be the direct operating source code, the kernel, or something in-between.
  • model: How the operating system is sold to end users. Can be open_source, mixed, and closed_source.
  • state: If this is a current or discountinued operating system.
  • type: Most operating systems are defined as being the direct computing layer an end user interacts with. Some operating systems act more abstract naming conventions then a concrete distrubtion. Values for this are distribution, abstract, kernel, and alias.
  • to: For alias typed define operating systems, this is used to point the actual named operating system. EG: rhel is an alias to redhat.

Kanrisuru defines the distribution hierarchy as follows: OS upstream graph showing dependencies that are resolved with the os_define method and OS distribtuion

These upstream definition is part of how os_define will resolve operating system distributions with similar packages based on what level in the hierarchy the package is defined. EG, the command pwd on a linux based system behaves mostly synonymously across all downstream operating system sources. While Linux itself is more specifically a kernel type, it’s treaded as an upstream provider since it’s integrated in all of the downstream sources at the most intimate level of how the operating system behaves.

Kanrisuru defines the OS family hierarchy as follows: OS upstream graph showing dependencies that are resolved with the os_define method and the release type

Each OS type, whether it be a distrubtion, abstract or kernel type release, is treated as an os-family. Much like the upstream definition, os-family defines the hierarchies of operating systems that belong to a group of a similar family. This can help define packages that an entire family of operating systems all act the same.

Public Class Methods

family_include_distribution?

Determine if the for the given family, whether a distribution belongs in that family. Will recursively move to the upstream source to detect at each level, if the distribtuion belongs in the family group.

Kanrisuru::Util::OsFamily.family_include_distribution?('linux', 'redhat')
true

## Can also pass in similarly defined spellings of well known operating systems.
Kanrisuru::Util::OsFamily.family_include_distribution?('unix_like', 'mac')
true

Kanrisuru::Util::OsFamily.family_include_distribution?('unix', 'ubuntu')
true

upstream_include_distribution?

Determine if for the given upstream source, whether a distribution belongs to the hierarchy of upstream sources.

Kanrisuru::Util::OsFamily.upstream_include_distribution?('fedora', 'centos')
true

Kanrisuru::Util::OsFamily.upstream_include_distribution?('linux', 'opensuse_leap')
true

Kanrisuru::Util::OsFamily.upstream_include_distribution?('unix', 'linux_mint')
true

[]

Lookup details of a defined operating system.

Kanrisuru::Util::OsFamily['debian']
{
         :name => "Debian",
    :os_family => "linux",
     :upstream => "linux",
        :model => "open_source",
        :state => "current",
         :type => "distribution"
}