Sha256: f39fa55af06fd10e36e71a88ac8ce492fb72318171a8d6fe526fcb6ec6d92db8

Contents?: true

Size: 1.45 KB

Versions: 8

Compression:

Stored size: 1.45 KB

Contents

module VagrantPlugins
  module Parallels
    module GuestLinuxCap
      class MountParallelsSharedFolder

        def self.mount_parallels_shared_folder(machine, name, guestpath, options)
          # Expand the guest path so we can handle things like "~/vagrant"
          expanded_guest_path = machine.guest.capability(
            :shell_expand_guest_path, guestpath)

          machine.communicate.tap do |comm|
            # clear prior symlink
            if comm.test("test -L \"#{expanded_guest_path}\"", :sudo => true)
              comm.sudo("rm \"#{expanded_guest_path}\"")
            end

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

            # create intermediate directories if needed
            intermediate_dir = File.dirname(expanded_guest_path)
            if !comm.test("test -d \"#{intermediate_dir}\"", :sudo => true)
              comm.sudo("mkdir -p \"#{intermediate_dir}\"")
            end

            # finally make the symlink
            comm.sudo("ln -s \"/media/psf/#{name}\" \"#{expanded_guest_path}\"")

            # Emit an upstart event if we can
            if comm.test("test -x /sbin/initctl")
              comm.sudo(
                "/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=#{expanded_guest_path}")
            end
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vagrant-parallels-1.0.8 lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.rb
vagrant-parallels-1.0.7 lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.rb
vagrant-parallels-1.0.6 lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.rb
vagrant-parallels-1.0.6.rc1 lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.rb
vagrant-parallels-1.0.2 lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.rb
vagrant-parallels-1.0.1 lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.rb
vagrant-parallels-1.0.0 lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.rb
vagrant-parallels-0.2.2 lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.rb