Merge pull request #4710 from tarrant/master
guests/tinycore: Add DHCP support for tinycore
This commit is contained in:
commit
b5e015c171
|
@ -8,7 +8,8 @@ module VagrantPlugins
|
||||||
machine.communicate.tap do |comm|
|
machine.communicate.tap do |comm|
|
||||||
networks.each do |n|
|
networks.each do |n|
|
||||||
if n[:type] == :dhcp
|
if n[:type] == :dhcp
|
||||||
raise Errors::NetworkStaticOnly
|
comm.sudo("/sbin/udhcpc -b -i eth#{n[:interface]} -p /var/run/udhcpc.eth#{n[:interface]}.pid")
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
ifc = "/sbin/ifconfig eth#{n[:interface]}"
|
ifc = "/sbin/ifconfig eth#{n[:interface]}"
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
module VagrantPlugins
|
|
||||||
module GuestTinyCore
|
|
||||||
module Errors
|
|
||||||
class TinyCoreError < Vagrant::Errors::VagrantError
|
|
||||||
error_namespace("vagrant_tinycore.errors")
|
|
||||||
end
|
|
||||||
|
|
||||||
class NetworkStaticOnly < TinyCoreError
|
|
||||||
error_key(:network_static_only)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -2,45 +2,29 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module GuestTinyCore
|
module GuestTinyCore
|
||||||
autoload :Errors, File.expand_path("../errors", __FILE__)
|
|
||||||
|
|
||||||
class Plugin < Vagrant.plugin("2")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "TinyCore Linux guest."
|
name "TinyCore Linux guest."
|
||||||
description "TinyCore Linux guest support."
|
description "TinyCore Linux guest support."
|
||||||
|
|
||||||
guest("tinycore", "linux") do
|
guest("tinycore", "linux") do
|
||||||
require File.expand_path("../guest", __FILE__)
|
require File.expand_path("../guest", __FILE__)
|
||||||
init!
|
|
||||||
Guest
|
Guest
|
||||||
end
|
end
|
||||||
|
|
||||||
guest_capability("tinycore", "configure_networks") do
|
guest_capability("tinycore", "configure_networks") do
|
||||||
require_relative "cap/configure_networks"
|
require_relative "cap/configure_networks"
|
||||||
init!
|
|
||||||
Cap::ConfigureNetworks
|
Cap::ConfigureNetworks
|
||||||
end
|
end
|
||||||
|
|
||||||
guest_capability("tinycore", "halt") do
|
guest_capability("tinycore", "halt") do
|
||||||
require_relative "cap/halt"
|
require_relative "cap/halt"
|
||||||
init!
|
|
||||||
Cap::Halt
|
Cap::Halt
|
||||||
end
|
end
|
||||||
|
|
||||||
guest_capability("tinycore", "rsync_install") do
|
guest_capability("tinycore", "rsync_install") do
|
||||||
require_relative "cap/rsync"
|
require_relative "cap/rsync"
|
||||||
init!
|
|
||||||
Cap::RSync
|
Cap::RSync
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def self.init!
|
|
||||||
return if defined?(@_init)
|
|
||||||
I18n.load_path << File.expand_path(
|
|
||||||
"templates/locales/guest_tinycore.yml", Vagrant.source_root)
|
|
||||||
I18n.reload!
|
|
||||||
@_init = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
en:
|
|
||||||
vagrant_tinycore:
|
|
||||||
errors:
|
|
||||||
network_static_only: |-
|
|
||||||
The TinyCore guest doesn't support DHCP for networks. Please use
|
|
||||||
a static assigned IP. If you know how to configure DHCP for
|
|
||||||
TinyCore, please open an issue on Vagrant with the steps and we'd
|
|
||||||
be happy to bring this functionality in.
|
|
Loading…
Reference in New Issue