Class: PKGWizard::Distribution

Inherits:
Object
  • Object
show all
Defined in:
lib/pkg-wizard.rb

Class Method Summary collapse

Class Method Details

.detectObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pkg-wizard.rb', line 10

def self.detect
  if File.exist?('/etc/redhat-release') and \
    File.read('/etc/redhat-release') =~ /Fedora/
    return Fedora.new
  end
  if File.exist?('/etc/redhat-release') and \
    File.read('/etc/redhat-release') =~ /FrameOS|RedHat|CentOS/
    return RedHat.new
  end
  if `lsb_release -i` =~ /Ubuntu/
    return Ubuntu.new
  end
  return UnknownDistro.new
end