vagrant/plugins/hosts/redhat/host.rb

31 lines
810 B
Ruby
Raw Normal View History

2012-04-19 05:20:45 +00:00
require "pathname"
2011-12-12 07:22:44 +00:00
2012-05-23 23:03:14 +00:00
require "vagrant"
2012-04-19 05:20:45 +00:00
module VagrantPlugins
2013-10-05 16:40:23 +00:00
module HostRedHat
2014-01-08 05:11:59 +00:00
class Host < Vagrant.plugin("2", :host)
2014-01-08 05:18:36 +00:00
def detect?(env)
2011-12-12 07:22:44 +00:00
release_file = Pathname.new("/etc/redhat-release")
if release_file.exist?
release_file.open("r:ISO-8859-1:UTF-8") do |f|
contents = f.gets
return true if contents =~ /^CentOS/ # CentOS
return true if contents =~ /^Fedora/ # Fedora
return true if contents =~ /^Korora/ # Korora
2011-12-12 07:22:44 +00:00
2014-01-08 05:11:59 +00:00
# Oracle Linux < 5.3
return true if contents =~ /^Enterprise Linux Enterprise Linux/
2014-01-08 05:11:59 +00:00
# Red Hat Enterprise Linux and Oracle Linux >= 5.3
return true if contents =~ /^Red Hat Enterprise Linux/
2012-09-19 05:19:51 +00:00
end
end
2014-01-08 05:11:59 +00:00
false
end
end
end
end