vagrant/plugins/guests/freebsd/cap/mount_nfs_folder.rb

25 lines
622 B
Ruby
Raw Normal View History

2013-04-04 18:56:42 +00:00
module VagrantPlugins
module GuestFreeBSD
module Cap
class MountNFSFolder
def self.mount_nfs_folder(machine, ip, folders)
comm = machine.communicate
commands = []
folders.each do |_, opts|
2014-09-18 15:14:13 +00:00
if opts[:nfs_version]
mount_opts = "-o nfsv#{opts[:nfs_version]}"
2014-10-23 17:04:58 +00:00
end
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
comm.sudo(commands.join("\n"), { shell: "sh" })
2013-04-04 18:56:42 +00:00
end
end
end
end
end