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)
|
||||
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
|
||||
# proper NFS binary. This checks to see if we need to do that.
|
||||
|
@ -41,13 +41,16 @@ module VagrantPlugins
|
|||
if version_number >= 16
|
||||
# "service nfs-server" will redirect properly to systemctl
|
||||
# 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
|
||||
rescue Errno::ENOENT
|
||||
# File doesn't exist, not a big deal, assume we're on a
|
||||
# lower version.
|
||||
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
|
||||
|
|
|
@ -17,7 +17,9 @@ module VagrantPlugins
|
|||
def initialize(*args)
|
||||
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
|
||||
|
|
|
@ -24,7 +24,9 @@ module VagrantPlugins
|
|||
super
|
||||
|
||||
@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
|
||||
|
||||
def nfs?
|
||||
|
@ -71,9 +73,11 @@ module VagrantPlugins
|
|||
system(%Q[sudo su root -c "echo '#{line}' >> /etc/exports"])
|
||||
end
|
||||
|
||||
# We run restart here instead of "update" just in case nfsd
|
||||
# is not starting
|
||||
system("sudo #{@nfs_server_binary} restart")
|
||||
if nfs_running?
|
||||
system("sudo #{@nfs_apply_command}")
|
||||
else
|
||||
system("sudo #{@nfs_start_command}")
|
||||
end
|
||||
end
|
||||
|
||||
def nfs_prune(valid_ids)
|
||||
|
@ -104,6 +108,10 @@ module VagrantPlugins
|
|||
|
||||
protected
|
||||
|
||||
def nfs_running?
|
||||
system("#{@nfs_check_command}")
|
||||
end
|
||||
|
||||
def nfs_cleanup(id)
|
||||
return if !File.exist?("/etc/exports")
|
||||
|
||||
|
|
|
@ -27,7 +27,9 @@ module VagrantPlugins
|
|||
def initialize(*args)
|
||||
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
|
||||
|
|
|
@ -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