-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #235 from legal90/darwin-install_parallels_tools
Add "install_parallels_tools" guest cap for Darwin guests
- Loading branch information
Showing
3 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
lib/vagrant-parallels/guest_cap/darwin/install_parallels_tools.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters