Module: CommandKit::OS::Linux::ClassMethods

Defined in:
lib/command_kit/os/linux.rb

Overview

Since:

  • 0.2.0

Instance Method Summary collapse

Instance Method Details

#linux_distro:fedora, ...

Determines the specific Linux distro.

Returns:

  • (:fedora, :redhat, :debian, :suse, :arch, nil)

    Returns the type of Linux distro or nil if the Linux distro could not be determined.

Since:

  • 0.2.0



69
70
71
72
73
74
75
76
# File 'lib/command_kit/os/linux.rb', line 69

def linux_distro
  if    File.file?('/etc/fedora-release') then :fedora
  elsif File.file?('/etc/redhat-release') then :redhat
  elsif File.file?('/etc/debian_version') then :debian
  elsif File.file?('/etc/SuSE-release')   then :suse
  elsif File.file?('/etc/arch-release')   then :arch
  end
end