Module: OS::Linux Private

Defined in:
Library/Homebrew/os/linux.rb,
Library/Homebrew/os/linux/glibc.rb,
Library/Homebrew/os/linux/kernel.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Helper module for querying system information on Linux.

Defined Under Namespace

Modules: Glibc, Kernel

Class Method Summary collapse

Class Method Details

.os_versionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'Library/Homebrew/os/linux.rb', line 8

def os_version
  if which("lsb_release")
    description = Utils.popen_read("lsb_release -d")
                       .chomp
                       .sub("Description:\t", "")
    codename = Utils.popen_read("lsb_release -c")
                    .chomp
                    .sub("Codename:\t", "")
    "#{description} (#{codename})"
  elsif (redhat_release = Pathname.new("/etc/redhat-release")).readable?
    redhat_release.read.chomp
  else
    "Unknown"
  end
end