Merge pull request #2077 from miurahr/exportfs
Improvement of Linux supports and NFS handling using exportfs
This commit is contained in:
commit
e8d2e05c4e
|
@ -30,7 +30,7 @@ module VagrantPlugins
|
||||||
def initialize(*args)
|
def initialize(*args)
|
||||||
super
|
super
|
||||||
|
|
||||||
@nfs_server_binary = "/etc/init.d/nfs"
|
nfs_server_binary = "/etc/init.d/nfs"
|
||||||
|
|
||||||
# On Fedora 16+, systemd replaced init.d, so we have to use the
|
# On Fedora 16+, systemd replaced init.d, so we have to use the
|
||||||
# proper NFS binary. This checks to see if we need to do that.
|
# proper NFS binary. This checks to see if we need to do that.
|
||||||
|
@ -41,13 +41,16 @@ module VagrantPlugins
|
||||||
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
|
||||||
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.
|
||||||
end
|
end
|
||||||
|
@nfs_apply_command = "/usr/sbin/exportfs -r"
|
||||||
|
@nfs_check_command = "#{nfs_server_binary} status"
|
||||||
|
@nfs_start_command = "#{nfs_server_binary} start"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,9 @@ module VagrantPlugins
|
||||||
def initialize(*args)
|
def initialize(*args)
|
||||||
super
|
super
|
||||||
|
|
||||||
@nfs_server_binary = "/etc/init.d/nfs"
|
@nfs_apply_command = "/usr/sbin/exportfs -r"
|
||||||
|
@nfs_check_command = "service nfs status"
|
||||||
|
@nfs_start_command = "service nfs start"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,7 +24,9 @@ module VagrantPlugins
|
||||||
super
|
super
|
||||||
|
|
||||||
@logger = Log4r::Logger.new("vagrant::hosts::linux")
|
@logger = Log4r::Logger.new("vagrant::hosts::linux")
|
||||||
@nfs_server_binary = "/etc/init.d/nfs-kernel-server"
|
@nfs_apply_command = "/usr/sbin/exportfs -r"
|
||||||
|
@nfs_check_command = "/etc/init.d/nfs-kernel-server status"
|
||||||
|
@nfs_start_command = "/etc/init.d/nfs-kernel-server start"
|
||||||
end
|
end
|
||||||
|
|
||||||
def nfs?
|
def nfs?
|
||||||
|
@ -71,9 +73,11 @@ module VagrantPlugins
|
||||||
system(%Q[sudo su root -c "echo '#{line}' >> /etc/exports"])
|
system(%Q[sudo su root -c "echo '#{line}' >> /etc/exports"])
|
||||||
end
|
end
|
||||||
|
|
||||||
# We run restart here instead of "update" just in case nfsd
|
if nfs_running?
|
||||||
# is not starting
|
system("sudo #{@nfs_apply_command}")
|
||||||
system("sudo #{@nfs_server_binary} restart")
|
else
|
||||||
|
system("sudo #{@nfs_start_command}")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def nfs_prune(valid_ids)
|
def nfs_prune(valid_ids)
|
||||||
|
@ -104,6 +108,10 @@ module VagrantPlugins
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
def nfs_running?
|
||||||
|
system("#{@nfs_check_command}")
|
||||||
|
end
|
||||||
|
|
||||||
def nfs_cleanup(id)
|
def nfs_cleanup(id)
|
||||||
return if !File.exist?("/etc/exports")
|
return if !File.exist?("/etc/exports")
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,9 @@ module VagrantPlugins
|
||||||
def initialize(*args)
|
def initialize(*args)
|
||||||
super
|
super
|
||||||
|
|
||||||
@nfs_server_binary = "/etc/init.d/nfsserver"
|
@nfs_apply_command = "/usr/sbin/exportfs -r"
|
||||||
|
@nfs_check_command = "service nfsserver status"
|
||||||
|
@nfs_start_command = "service nfsserver start"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
require "vagrant"
|
||||||
|
|
||||||
|
require Vagrant.source_root.join("plugins/hosts/linux/host")
|
||||||
|
|
||||||
|
module VagrantPlugins
|
||||||
|
module HostSlackware
|
||||||
|
class Host < VagrantPlugins::HostLinux::Host
|
||||||
|
def self.match?
|
||||||
|
return File.exists?("/etc/slackware-release") || Dir.glob("/usr/lib/setup/Plamo-*").length > 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# Normal, mid-range precedence.
|
||||||
|
def self.precedence
|
||||||
|
5
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize(*args)
|
||||||
|
super
|
||||||
|
|
||||||
|
@nfs_apply_command = "/usr/sbin/exportfs -r"
|
||||||
|
@nfs_check_command = "pidof nfsd > /dev/null"
|
||||||
|
@nfs_start_command = "/etc/rc.d/rc.nfsd start"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,15 @@
|
||||||
|
require "vagrant"
|
||||||
|
|
||||||
|
module VagrantPlugins
|
||||||
|
module HostSlackware
|
||||||
|
class Plugin < Vagrant.plugin("2")
|
||||||
|
name "Slackware host"
|
||||||
|
description "Slackware and derivertives host support."
|
||||||
|
|
||||||
|
host("slackware") do
|
||||||
|
require File.expand_path("../host", __FILE__)
|
||||||
|
Host
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue