diff --git a/lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb b/lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb new file mode 100644 index 00000000..0097dabf --- /dev/null +++ b/lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb @@ -0,0 +1,34 @@ +module VagrantPlugins + module Parallels + module GuestDarwinCap + class InstallParallelsTools + + def self.install_parallels_tools(machine) + machine.communicate.tap do |comm| + tools_iso_path = File.expand_path( + machine.provider.driver.read_guest_tools_iso_path('darwin'), + 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 diff --git a/lib/vagrant-parallels/plugin.rb b/lib/vagrant-parallels/plugin.rb index 01eabed7..e1e48263 100644 --- a/lib/vagrant-parallels/plugin.rb +++ b/lib/vagrant-parallels/plugin.rb @@ -33,6 +33,11 @@ class Plugin < Vagrant.plugin('2') Config end + guest_capability(:darwin, :install_parallels_tools) do + require_relative 'guest_cap/darwin/install_parallels_tools' + GuestDarwinCap::InstallParallelsTools + end + guest_capability(:darwin, :mount_parallels_shared_folder) do require_relative 'guest_cap/darwin/mount_parallels_shared_folder' GuestDarwinCap::MountParallelsSharedFolder diff --git a/website/docs/source/docs/configuration.html.md b/website/docs/source/docs/configuration.html.md index 734cce93..6ae78fe2 100755 --- a/website/docs/source/docs/configuration.html.md +++ b/website/docs/source/docs/configuration.html.md @@ -57,8 +57,8 @@ delete your boxes carefully! ## Parallels Tools Auto-Update

- Note: This feature makes sense to Linux guests only. - In Windows and Mac OS guests Parallels Tools will be always updated + Note: This feature makes sense to Linux and OS X guests + only. In Windows guests Parallels Tools will be always updated automatically by the special installation agent running in GUI mode.