Convert lineendings for the other guests as well

This commit is contained in:
Mitchell Hashimoto 2012-02-10 18:14:51 -08:00
parent ba42fffed0
commit c50c7959f9
3 changed files with 31 additions and 4 deletions

View File

@ -1,9 +1,16 @@
require 'set'
require 'tempfile'
require 'vagrant/util/line_ending_helpers'
require 'vagrant/util/template_renderer'
module Vagrant
module Guest
class Arch < Linux
# Make the TemplateRenderer top-level
include Vagrant::Util
include Vagrant::Util::LineEndingHelpers
def change_host_name(name)
# Only do this if the hostname is not already set
if !vm.channel.test("sudo hostname | grep '#{name}'")
@ -23,8 +30,12 @@ module Vagrant
entries = []
networks.each do |network|
interfaces.add(network[:interface])
entries << TemplateRenderer.render("guests/arch/network_#{network[:type]}",
:options => network)
entry = TemplateRenderer.render("guests/arch/network_#{network[:type]}",
:options => network)
# Convert to proper line endings
entry = dos_to_unix(entry)
entries << entry
end
# Perform the careful dance necessary to reconfigure

View File

@ -1,6 +1,7 @@
require 'set'
require 'tempfile'
require 'vagrant/util/line_ending_helpers'
require 'vagrant/util/template_renderer'
module Vagrant
@ -8,6 +9,7 @@ module Vagrant
class Debian < Linux
# Make the TemplateRenderer top-level
include Vagrant::Util
include Vagrant::Util::LineEndingHelpers
def configure_networks(networks)
# First, remove any previous network modifications
@ -22,8 +24,12 @@ module Vagrant
entries = []
networks.each do |network|
interfaces.add(network[:interface])
entries << TemplateRenderer.render("guests/debian/network_#{network[:type]}",
:options => network)
entry = TemplateRenderer.render("guests/debian/network_#{network[:type]}",
:options => network)
# Convert line endings properly and save
entry = dos_to_unix(entry)
entries << entry
end
# Perform the careful dance necessary to reconfigure

View File

@ -1,8 +1,15 @@
require 'tempfile'
require 'vagrant/util/line_ending_helpers'
require 'vagrant/util/template_renderer'
module Vagrant
module Guest
class Gentoo < Linux
# Make the TemplateRenderer top-level
include Vagrant::Util
include Vagrant::Util::LineEndingHelpers
def configure_networks(networks)
# Remove any previous host only network additions to the interface file
vm.channel.sudo("sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/conf.d/net > /tmp/vagrant-network-interfaces")
@ -13,6 +20,9 @@ module Vagrant
entry = TemplateRenderer.render("guests/gentoo/network_#{network[:type]}",
:options => network)
# Convert to proper lineendings
entry = dos_to_unix(entry)
# Upload the entry to a temporary location
temp = Tempfile.new("vagrant")
temp.write(entry)