2012-04-19 05:20:45 +00:00
|
|
|
require "pathname"
|
2012-02-28 10:55:39 +00:00
|
|
|
|
2012-05-23 23:03:14 +00:00
|
|
|
require "vagrant"
|
|
|
|
|
2012-04-19 05:20:45 +00:00
|
|
|
module VagrantPlugins
|
2014-09-11 08:48:58 +00:00
|
|
|
module HostSUSE
|
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)
|
2014-09-11 08:48:58 +00:00
|
|
|
old_release_file = Pathname.new("/etc/SuSE-release")
|
2012-02-28 10:55:39 +00:00
|
|
|
|
2014-09-11 08:48:58 +00:00
|
|
|
if old_release_file.exist?
|
|
|
|
old_release_file.open("r") do |f|
|
|
|
|
return true if f.gets =~ /^(openSUSE|SUSE Linux Enterprise)/
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
new_release_file = Pathname.new("/etc/os-release")
|
|
|
|
|
|
|
|
if new_release_file.exist?
|
|
|
|
new_release_file.open("r") do |f|
|
|
|
|
return true if f.gets =~ /(openSUSE|SLES)/
|
2012-02-28 10:55:39 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|