Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "install_parallels_tools" guest cap for Darwin guests #235

Merged
merged 1 commit into from
Nov 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions lib/vagrant-parallels/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions website/docs/source/docs/configuration.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ delete your boxes carefully!
## Parallels Tools Auto-Update
<div class="alert alert-info">
<p>
<strong>Note:</strong> This feature makes sense to Linux guests only.
In Windows and Mac OS guests Parallels Tools will be always updated
<strong>Note:</strong> 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.
</p>
</div>
Expand Down