Working implementation with NFS, still some caveats:
- There's a lengthy sleep in there, probably could use a back-off loop - en1 seems totally worthless on vbox, I skip it and just use the en2 it creates.
This commit is contained in:
parent
2b7aca1d83
commit
5606aa8b1e
|
@ -1,5 +1,5 @@
|
|||
module VagrantPlugins
|
||||
module GuestFreeDarwin
|
||||
module GuestDarwin
|
||||
module Cap
|
||||
class ChangeHostName
|
||||
def self.change_host_name(machine, name)
|
||||
|
|
|
@ -3,7 +3,7 @@ require "tempfile"
|
|||
require "vagrant/util/template_renderer"
|
||||
|
||||
module VagrantPlugins
|
||||
module GuestFreeDarwin
|
||||
module GuestDarwin
|
||||
module Cap
|
||||
class ConfigureNetworks
|
||||
include Vagrant::Util
|
||||
|
@ -12,6 +12,7 @@ module VagrantPlugins
|
|||
# Slightly different than other plugins, using the template to build commands
|
||||
# rather than templating the files.
|
||||
|
||||
machine.communicate.sudo("networksetup -detectnewhardware")
|
||||
devmap = {}
|
||||
machine.communicate.sudo("networksetup -listnetworkserviceorder > /tmp/vagrant.interfaces")
|
||||
tmpints = File.join(Dir.tmpdir, "#{machine.id}.interfaces")
|
||||
|
@ -24,14 +25,14 @@ module VagrantPlugins
|
|||
# (Hardware Port: Thunderbolt Ethernet, Device: en1)
|
||||
devicearry = i.match(/Hardware Port: (.+), Device: en(.+)\)/)
|
||||
devmap[devicearry[2]] = devicearry[1]
|
||||
puts devmap
|
||||
end
|
||||
end
|
||||
networks.each do |network|
|
||||
|
||||
|
||||
if network[:type].to_sym == :static
|
||||
# network seems 1 indexed - skip NAT interface (en0)
|
||||
intnum = network[:interface]
|
||||
# network seems 1 indexed - skip NAT interface (en0) also en1 because it seems to not *really* exist on virtualbox?
|
||||
intnum = network[:interface] + 1
|
||||
puts "Network - #{intnum}"
|
||||
command = "networksetup -setmanual \"#{devmap[intnum.to_s]}\" #{network[:ip]} #{network[:netmask]} #{network[:gateway]}"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module VagrantPlugins
|
||||
module GuestFreeDarwin
|
||||
module GuestDarwin
|
||||
module Cap
|
||||
class Halt
|
||||
def self.halt(machine)
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
module VagrantPlugins
|
||||
module GuestFreeDarwin
|
||||
module Cap
|
||||
class MountNFSFolder
|
||||
def self.mount_nfs_folder(machine, ip, folders)
|
||||
folders.each do |name, opts|
|
||||
machine.communicate.sudo("mkdir -p #{opts[:guestpath]}")
|
||||
machine.communicate.sudo("mount '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'")
|
||||
end
|
||||
module GuestDarwin
|
||||
module Cap
|
||||
class MountNFSFolder
|
||||
def self.mount_nfs_folder(machine, ip, folders)
|
||||
puts "30 second nap...."
|
||||
sleep(30)
|
||||
folders.each do |name, opts|
|
||||
machine.communicate.sudo("if [ ! -d #{opts[:guestpath]} ]; then mkdir -p #{opts[:guestpath]};fi")
|
||||
machine.communicate.sudo("mount -t nfs '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'vagrant/util/template_renderer'
|
||||
|
||||
module VagrantPlugins
|
||||
module GuestFreeDarwin
|
||||
module GuestDarwin
|
||||
# A general Vagrant system implementation for "freebsd".
|
||||
#
|
||||
# Contributed by Kenneth Vestergaard <kvs@binarysolutions.dk>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "vagrant"
|
||||
|
||||
module VagrantPlugins
|
||||
module GuestFreeDarwin
|
||||
module GuestDarwin
|
||||
class Plugin < Vagrant.plugin("2")
|
||||
name "Darwin guest"
|
||||
description "Darwin guest support."
|
||||
|
|
Loading…
Reference in New Issue