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 VagrantPlugins
|
||||||
module GuestFreeDarwin
|
module GuestDarwin
|
||||||
module Cap
|
module Cap
|
||||||
class ChangeHostName
|
class ChangeHostName
|
||||||
def self.change_host_name(machine, name)
|
def self.change_host_name(machine, name)
|
||||||
|
|
|
@ -3,7 +3,7 @@ require "tempfile"
|
||||||
require "vagrant/util/template_renderer"
|
require "vagrant/util/template_renderer"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module GuestFreeDarwin
|
module GuestDarwin
|
||||||
module Cap
|
module Cap
|
||||||
class ConfigureNetworks
|
class ConfigureNetworks
|
||||||
include Vagrant::Util
|
include Vagrant::Util
|
||||||
|
@ -12,6 +12,7 @@ module VagrantPlugins
|
||||||
# Slightly different than other plugins, using the template to build commands
|
# Slightly different than other plugins, using the template to build commands
|
||||||
# rather than templating the files.
|
# rather than templating the files.
|
||||||
|
|
||||||
|
machine.communicate.sudo("networksetup -detectnewhardware")
|
||||||
devmap = {}
|
devmap = {}
|
||||||
machine.communicate.sudo("networksetup -listnetworkserviceorder > /tmp/vagrant.interfaces")
|
machine.communicate.sudo("networksetup -listnetworkserviceorder > /tmp/vagrant.interfaces")
|
||||||
tmpints = File.join(Dir.tmpdir, "#{machine.id}.interfaces")
|
tmpints = File.join(Dir.tmpdir, "#{machine.id}.interfaces")
|
||||||
|
@ -24,14 +25,14 @@ module VagrantPlugins
|
||||||
# (Hardware Port: Thunderbolt Ethernet, Device: en1)
|
# (Hardware Port: Thunderbolt Ethernet, Device: en1)
|
||||||
devicearry = i.match(/Hardware Port: (.+), Device: en(.+)\)/)
|
devicearry = i.match(/Hardware Port: (.+), Device: en(.+)\)/)
|
||||||
devmap[devicearry[2]] = devicearry[1]
|
devmap[devicearry[2]] = devicearry[1]
|
||||||
puts devmap
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
networks.each do |network|
|
networks.each do |network|
|
||||||
|
|
||||||
|
|
||||||
if network[:type].to_sym == :static
|
if network[:type].to_sym == :static
|
||||||
# network seems 1 indexed - skip NAT interface (en0)
|
# network seems 1 indexed - skip NAT interface (en0) also en1 because it seems to not *really* exist on virtualbox?
|
||||||
intnum = network[:interface]
|
intnum = network[:interface] + 1
|
||||||
puts "Network - #{intnum}"
|
puts "Network - #{intnum}"
|
||||||
command = "networksetup -setmanual \"#{devmap[intnum.to_s]}\" #{network[:ip]} #{network[:netmask]} #{network[:gateway]}"
|
command = "networksetup -setmanual \"#{devmap[intnum.to_s]}\" #{network[:ip]} #{network[:netmask]} #{network[:gateway]}"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module GuestFreeDarwin
|
module GuestDarwin
|
||||||
module Cap
|
module Cap
|
||||||
class Halt
|
class Halt
|
||||||
def self.halt(machine)
|
def self.halt(machine)
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module GuestFreeDarwin
|
module GuestDarwin
|
||||||
module Cap
|
module Cap
|
||||||
class MountNFSFolder
|
class MountNFSFolder
|
||||||
def self.mount_nfs_folder(machine, ip, folders)
|
def self.mount_nfs_folder(machine, ip, folders)
|
||||||
folders.each do |name, opts|
|
puts "30 second nap...."
|
||||||
machine.communicate.sudo("mkdir -p #{opts[:guestpath]}")
|
sleep(30)
|
||||||
machine.communicate.sudo("mount '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'")
|
folders.each do |name, opts|
|
||||||
end
|
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
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'vagrant/util/template_renderer'
|
require 'vagrant/util/template_renderer'
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module GuestFreeDarwin
|
module GuestDarwin
|
||||||
# A general Vagrant system implementation for "freebsd".
|
# A general Vagrant system implementation for "freebsd".
|
||||||
#
|
#
|
||||||
# Contributed by Kenneth Vestergaard <kvs@binarysolutions.dk>
|
# Contributed by Kenneth Vestergaard <kvs@binarysolutions.dk>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require "vagrant"
|
require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module GuestFreeDarwin
|
module GuestDarwin
|
||||||
class Plugin < Vagrant.plugin("2")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "Darwin guest"
|
name "Darwin guest"
|
||||||
description "Darwin guest support."
|
description "Darwin guest support."
|
||||||
|
|
Loading…
Reference in New Issue