2013-04-04 18:56:42 +00:00
|
|
|
module VagrantPlugins
|
|
|
|
module GuestFreeBSD
|
|
|
|
module Cap
|
|
|
|
class MountNFSFolder
|
|
|
|
def self.mount_nfs_folder(machine, ip, folders)
|
2016-06-05 18:00:02 +00:00
|
|
|
comm = machine.communicate
|
|
|
|
|
|
|
|
commands = []
|
|
|
|
|
|
|
|
folders.each do |_, opts|
|
2014-09-18 15:14:13 +00:00
|
|
|
if opts[:nfs_version]
|
2016-06-05 18:00:02 +00:00
|
|
|
mount_opts = "-o nfsv#{opts[:nfs_version]}"
|
2014-10-23 17:04:58 +00:00
|
|
|
end
|
|
|
|
|
2016-06-05 18:00:02 +00:00
|
|
|
commands << "mkdir -p '#{opts[:guestpath]}'"
|
|
|
|
commands << "mount -t nfs #{mount_opts} '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'"
|
2013-04-04 18:56:42 +00:00
|
|
|
end
|
2016-06-05 18:00:02 +00:00
|
|
|
|
|
|
|
comm.sudo(commands.join("\n"), { shell: "sh" })
|
2013-04-04 18:56:42 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|