diff --git a/plugins/guests/arch/guest.rb b/plugins/guests/arch/guest.rb index dfea865415e..dbb5ce97706 100644 --- a/plugins/guests/arch/guest.rb +++ b/plugins/guests/arch/guest.rb @@ -22,38 +22,19 @@ def change_host_name(name) end def configure_networks(networks) - # Remove previous Vagrant-managed network interfaces - vm.channel.sudo("sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/rc.conf > /tmp/vagrant-network-interfaces") - vm.channel.sudo("cat /tmp/vagrant-network-interfaces > /etc/rc.conf") - vm.channel.sudo("rm /tmp/vagrant-network-interfaces") - - # Configure the network interfaces - interfaces = Set.new - entries = [] networks.each do |network| interfaces.add(network[:interface]) - entry = TemplateRenderer.render("guests/arch/network_#{network[:type]}", - :options => network) - entries << entry - end - - # Perform the careful dance necessary to reconfigure - # the network interfaces - temp = Tempfile.new("vagrant") - temp.binmode - temp.write(entries.join("\n")) - temp.close - - vm.channel.upload(temp.path, "/tmp/vagrant-network-entry") + entry = TemplateRenderer.render("guests/arch/network_#{network[:type]}", :options => network) - # Reconfigure the network interfaces - vm.channel.sudo("cat /tmp/vagrant-network-entry >> /etc/rc.conf") - vm.channel.sudo("rm /tmp/vagrant-network-entry") - vm.channel.sudo("/etc/rc.d/network restart") + temp = Tempfile.new("vagrant") + temp.binmode + temp.write(entry) + temp.close - interfaces.each do |interface| - vm.channel.sudo("dhcpcd -k eth#{interface} && dhcpcd eth#{interface} && sleep 3") + vm.channel.upload(temp.path, temp.path) + vm.channel.sudo("mv #{temp.path} /etc/network.d/interfaces/eth#{network[:interface]}") + vm.channel.sudo("netcfg interfaces/eth#{interface}") end end end diff --git a/templates/guests/arch/network_dhcp.erb b/templates/guests/arch/network_dhcp.erb index 1fa0ef7027c..f7044f07101 100644 --- a/templates/guests/arch/network_dhcp.erb +++ b/templates/guests/arch/network_dhcp.erb @@ -1,7 +1,4 @@ -#VAGRANT-BEGIN -# The contents below are automatically generated by Vagrant. Do not modify. -interface=eth<%= options[:interface] %> -address= -netmask= -gateway= -#VAGRANT-END +CONNECTION='ethernet' +DESCRIPTION='A basic dhcp ethernet connection' +INTERFACE='eth<%= options[:interface] %>' +IP='dhcp' diff --git a/templates/guests/arch/network_static.erb b/templates/guests/arch/network_static.erb index ae65c28770a..61dfc140bd7 100644 --- a/templates/guests/arch/network_static.erb +++ b/templates/guests/arch/network_static.erb @@ -1,7 +1,6 @@ -#VAGRANT-BEGIN -# The contents below are automatically generated by Vagrant. Do not modify. -interface=eth<%= options[:interface] %> -address=<%= options[:ip]%> -netmask=<%= options[:netmask] %> -gateway= -#VAGRANT-END +CONNECTION='ethernet' +DESCRIPTION='A basic static ethernet connection' +INTERFACE='eth<%= options[:interface] %>' +IP='static' +ADDR='<%= options[:ip]%>' +NETMASK='<%= options[:netmask] %>'