Sha256: e658af09586f7a79abcbbcd657acf4f29cb8800821342a40f2bfa99c0ae255aa

Contents?: true

Size: 1.24 KB

Versions: 49

Compression:

Stored size: 1.24 KB

Contents

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
            if comm.test("test -L \"#{guestpath}\"", sudo: true)
              comm.sudo("rm -f \"#{guestpath}\"")
            end

            # clear prior directory if exists
            if comm.test("test -d \"#{guestpath}\"", sudo: true)
              comm.sudo("rm -Rf \"#{guestpath}\"")
            end

            # create intermediate directories if needed
            intermediate_dir = File.dirname(guestpath)
            if !comm.test("test -d \"#{intermediate_dir}\"", sudo: true)
              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

Version data entries

49 entries across 42 versions & 6 rubygems

Version Path
vagrant-unbundled-2.2.6.2 plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-unbundled-2.2.6.1 plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-unbundled-2.2.6.0 plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-unbundled-2.2.5.0 plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-unbundled-2.2.4.0 plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-unbundled-2.2.3.0 plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-unbundled-2.2.2.0 plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-unbundled-2.2.0.0 plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-unbundled-2.1.4.0 plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-unbundled-2.1.2.0 plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-unbundled-2.1.1.0 plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-unbundled-2.0.4.0 plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-unbundled-2.0.3.0 plugins/guests/darwin/cap/mount_vmware_shared_folder.rb
vagrant-aws-detiber-0.7.2.pre.4 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb