Class: VagrantPlugins::VMwareFreeBSD::Cap::MountVmwareSharedFolder

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-vmware-freebsd/cap/mount_vmware_shared_folder.rb

Class Method Summary collapse

Class Method Details

.mount_vmware_shared_folder(machine, name, guestpath, options) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/vagrant-vmware-freebsd/cap/mount_vmware_shared_folder.rb', line 5

def self.mount_vmware_shared_folder(machine, name, guestpath, options)
  machine.communicate.tap do |comm|
    comm.sudo("rm \"#{guestpath}\"")     if comm.test("test -L \"#{guestpath}\"", :sudo => true)
    comm.sudo("rm -Rf \"#{guestpath}\"") if comm.test("test -d \"#{guestpath}\"", :sudo => true)
    comm.sudo("mkdir -p \"#{guestpath}\"") # mkdir -p doesn't care if it exists already

    comm.sudo("mount -t vmhgfs \".host:/#{name}\" \"#{guestpath}\"")
  end
end