Sha256: 9d461396f7301763abf342c7c5e13818a5ecb83249b749e5c13dec4ead856b56

Contents?: true

Size: 1.28 KB

Versions: 9

Compression:

Stored size: 1.28 KB

Contents

module VagrantPlugins
  module Parallels
    module GuestDarwinCap
      class InstallParallelsTools

        def self.install_parallels_tools(machine)
          machine.communicate.tap do |comm|
            arch = ''
            comm.execute("uname -p") { |type, data| arch << data if type == :stdout }

            tools_iso_path = File.expand_path(
              machine.provider.driver.read_guest_tools_iso_path("darwin", arch),
              machine.env.root_path
            )
            remote_file = '/tmp/prl-tools-mac.iso'
            mount_point = "/media/prl-tools-lin_#{rand(100000)}/"

            comm.upload(tools_iso_path, remote_file)

            # Create mount point directory if needed
            if !comm.test("test -d \"#{mount_point}\"", :sudo => true)
              comm.sudo("mkdir -p \"#{mount_point}\"")
            end

            # Mount ISO and install Parallels Tools
            comm.sudo("hdiutil attach #{remote_file} -mountpoint #{mount_point}")
            comm.sudo("installer -pkg '#{mount_point}/Install.app/Contents/Resources/Install.mpkg' -target /")
            comm.sudo("hdiutil detach '#{mount_point}'")

            comm.sudo("rm -Rf \"#{mount_point}\"")
            comm.sudo("rm -f \"#{remote_file}\"")
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vagrant-parallels-2.4.5 lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb
vagrant-parallels-2.4.4 lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb
vagrant-parallels-2.4.2 lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb
vagrant-parallels-2.4.1 lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb
vagrant-parallels-2.4.0 lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb
vagrant-parallels-2.3.1 lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb
vagrant-parallels-2.3.0 lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb
vagrant-parallels-2.2.6 lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb
vagrant-parallels-2.2.5 lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb