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?
|
2013-09-07 17:40:23 +00:00
|
|
|
release_file.open("r:ISO-8859-1:UTF-8") do |f|
|
2013-07-18 15:23:46 +00:00
|
|
|
contents = f.gets
|
2013-10-05 17:01:27 +00:00
|
|
|
return true if contents =~ /^CentOS/ # CentOS
|
2014-01-21 17:50:20 +00:00
|
|
|
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/
|
2012-01-25 18:39:17 +00:00
|
|
|
|
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
|
2011-08-28 06:47:13 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|