2013-08-06 14:17:12 +00:00
|
|
|
module VagrantPlugins
|
|
|
|
module GuestDarwin
|
|
|
|
module Cap
|
|
|
|
class MountVmwareSharedFolder
|
|
|
|
|
|
|
|
# we seem to be unable to ask 'mount -t vmhgfs' to mount the roots
|
|
|
|
# of specific shares, so instead we symlink from what is already
|
|
|
|
# mounted by the guest tools
|
|
|
|
# (ie. the behaviour of the VMware_fusion provider prior to 0.8.x)
|
|
|
|
|
|
|
|
def self.mount_vmware_shared_folder(machine, name, guestpath, options)
|
|
|
|
machine.communicate.tap do |comm|
|
|
|
|
# clear prior symlink
|
2014-05-22 16:35:12 +00:00
|
|
|
if comm.test("test -L \"#{guestpath}\"", sudo: true)
|
2014-08-29 08:51:31 +00:00
|
|
|
comm.sudo("rm -f \"#{guestpath}\"")
|
2013-08-06 14:17:12 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# clear prior directory if exists
|
2014-05-22 16:35:12 +00:00
|
|
|
if comm.test("test -d \"#{guestpath}\"", sudo: true)
|
2013-08-06 14:17:12 +00:00
|
|
|
comm.sudo("rm -Rf \"#{guestpath}\"")
|
|
|
|
end
|
|
|
|
|
|
|
|
# create intermediate directories if needed
|
|
|
|
intermediate_dir = File.dirname(guestpath)
|
2014-05-22 16:35:12 +00:00
|
|
|
if !comm.test("test -d \"#{intermediate_dir}\"", sudo: true)
|
2013-08-06 14:17:12 +00:00
|
|
|
comm.sudo("mkdir -p \"#{intermediate_dir}\"")
|
|
|
|
end
|
|
|
|
|
|
|
|
# finally make the symlink
|
|
|
|
comm.sudo("ln -s \"/Volumes/VMware Shared Folders/#{name}\" \"#{guestpath}\"")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|