Merge pull request #2329 from mpioli/redhat
guests/redhat: create from fedora guest (migrate)
This commit is contained in:
commit
4049fd136f
|
@ -5,7 +5,7 @@ require "vagrant"
|
||||||
require Vagrant.source_root.join("plugins/hosts/linux/host")
|
require Vagrant.source_root.join("plugins/hosts/linux/host")
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module HostFedora
|
module HostRedHat
|
||||||
class Host < VagrantPlugins::HostLinux::Host
|
class Host < VagrantPlugins::HostLinux::Host
|
||||||
def self.match?
|
def self.match?
|
||||||
release_file = Pathname.new("/etc/redhat-release")
|
release_file = Pathname.new("/etc/redhat-release")
|
||||||
|
@ -13,9 +13,10 @@ module VagrantPlugins
|
||||||
if release_file.exist?
|
if release_file.exist?
|
||||||
release_file.open("r:ISO-8859-1:UTF-8") do |f|
|
release_file.open("r:ISO-8859-1:UTF-8") do |f|
|
||||||
contents = f.gets
|
contents = f.gets
|
||||||
return true if contents =~ /^Fedora/
|
return true if contents =~ /^Fedora/ # Fedora
|
||||||
return true if contents =~ /^CentOS/
|
return true if contents =~ /^CentOS/ # CentOS
|
||||||
return true if contents =~ /^Red Hat Enterprise Linux Server/
|
return true if contents =~ /^Enterprise Linux Enterprise Linux/ # Oracle Linux < 5.3
|
||||||
|
return true if contents =~ /^Red Hat Enterprise Linux/ # Red Hat Enterprise Linux and Oracle Linux >= 5.3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,13 +38,16 @@ module VagrantPlugins
|
||||||
release_file = Pathname.new("/etc/redhat-release")
|
release_file = Pathname.new("/etc/redhat-release")
|
||||||
begin
|
begin
|
||||||
release_file.open("r:ISO-8859-1:UTF-8") do |f|
|
release_file.open("r:ISO-8859-1:UTF-8") do |f|
|
||||||
version_number = /(CentOS|Fedora|Red Hat Enterprise Linux Server).*release ([0-9]+)/.match(f.gets)[2].to_i
|
fedora_match = /Fedora.* release ([0-9]+)/.match(f.gets)
|
||||||
|
if fedora_match
|
||||||
|
version_number = fedora_match[1].to_i
|
||||||
if version_number >= 16
|
if version_number >= 16
|
||||||
# "service nfs-server" will redirect properly to systemctl
|
# "service nfs-server" will redirect properly to systemctl
|
||||||
# when "service nfs-server restart" is called.
|
# when "service nfs-server restart" is called.
|
||||||
nfs_server_binary = "/usr/sbin/service nfs-server"
|
nfs_server_binary = "/usr/sbin/service nfs-server"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
rescue Errno::ENOENT
|
rescue Errno::ENOENT
|
||||||
# File doesn't exist, not a big deal, assume we're on a
|
# File doesn't exist, not a big deal, assume we're on a
|
||||||
# lower version.
|
# lower version.
|
|
@ -1,12 +1,12 @@
|
||||||
require "vagrant"
|
require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module HostFedora
|
module HostRedHat
|
||||||
class Plugin < Vagrant.plugin("2")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "Fedora host"
|
name "Red Hat host"
|
||||||
description "Fedora host support."
|
description "Red Hat host support."
|
||||||
|
|
||||||
host("fedora") do
|
host("redhat") do
|
||||||
require File.expand_path("../host", __FILE__)
|
require File.expand_path("../host", __FILE__)
|
||||||
Host
|
Host
|
||||||
end
|
end
|
Loading…
Reference in New Issue