Module: OS::Linux

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

Overview

Helper module for querying system information on Linux.

Defined Under Namespace

Modules: Glibc, Kernel

Class Method Summary collapse

Class Method Details

.os_versionObject


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

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