diff --git a/plugins/hosts/bsd/host.rb b/plugins/hosts/bsd/host.rb index 88d28a7ec..a0fa6e285 100644 --- a/plugins/hosts/bsd/host.rb +++ b/plugins/hosts/bsd/host.rb @@ -2,10 +2,10 @@ require "vagrant" module VagrantPlugins module HostBSD - # Represents a BSD host, such as FreeBSD and Darwin (Mac OS X). + # Represents a BSD host, such as FreeBSD. class Host < Vagrant.plugin("2", :host) def detect?(env) - Vagrant::Util::Platform.darwin? || Vagrant::Util::Platform.bsd? + Vagrant::Util::Platform.darwin? end end end diff --git a/plugins/hosts/darwin/cap/rdp.rb b/plugins/hosts/darwin/cap/rdp.rb new file mode 100644 index 000000000..a33ba008f --- /dev/null +++ b/plugins/hosts/darwin/cap/rdp.rb @@ -0,0 +1,33 @@ +require "tempfile" + +require "vagrant/util/subprocess" + +module VagrantPlugins + module HostDarwin + module Cap + class RDP + def self.rdp_client(env, rdp_info) + config = nil + opts = { + "drivestoredirect:s" => "*", + "full address:s" => "#{rdp_info[:host]}:#{rdp_info[:port]}", + "prompt for credentials:i" => "1", + "username:s" => rdp_info[:username], + } + + # Create the ".rdp" file + config = Tempfile.new(["vagrant-rdp", ".rdp"]) + opts.each do |k, v| + config.puts("#{k}:#{v}") + end + config.close + + # Launch it + Vagrant::Util::Subprocess.execute("open", config.path) + ensure + config.close if config + end + end + end + end +end diff --git a/plugins/hosts/darwin/host.rb b/plugins/hosts/darwin/host.rb new file mode 100644 index 000000000..080d5d4f0 --- /dev/null +++ b/plugins/hosts/darwin/host.rb @@ -0,0 +1,11 @@ +require "vagrant/util/platform" + +module VagrantPlugins + module HostDarwin + class Host < Vagrant.plugin("2", :host) + def detect?(env) + Vagrant::Util::Platform.darwin? + end + end + end +end diff --git a/plugins/hosts/darwin/plugin.rb b/plugins/hosts/darwin/plugin.rb new file mode 100644 index 000000000..226a5bae1 --- /dev/null +++ b/plugins/hosts/darwin/plugin.rb @@ -0,0 +1,20 @@ +require "vagrant" + +module VagrantPlugins + module HostDarwin + class Plugin < Vagrant.plugin("2") + name "Mac OS X host" + description "Mac OS X host support." + + host("darwin", "bsd") do + require_relative "host" + Host + end + + host_capability("darwin", "rdp_client") do + require_relative "cap/rdp" + Cap::RDP + end + end + end +end