Convert lineendings for the other guests as well
This commit is contained in:
parent
ba42fffed0
commit
c50c7959f9
|
@ -1,9 +1,16 @@
|
||||||
require 'set'
|
require 'set'
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
|
|
||||||
|
require 'vagrant/util/line_ending_helpers'
|
||||||
|
require 'vagrant/util/template_renderer'
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
module Guest
|
module Guest
|
||||||
class Arch < Linux
|
class Arch < Linux
|
||||||
|
# Make the TemplateRenderer top-level
|
||||||
|
include Vagrant::Util
|
||||||
|
include Vagrant::Util::LineEndingHelpers
|
||||||
|
|
||||||
def change_host_name(name)
|
def change_host_name(name)
|
||||||
# Only do this if the hostname is not already set
|
# Only do this if the hostname is not already set
|
||||||
if !vm.channel.test("sudo hostname | grep '#{name}'")
|
if !vm.channel.test("sudo hostname | grep '#{name}'")
|
||||||
|
@ -23,8 +30,12 @@ module Vagrant
|
||||||
entries = []
|
entries = []
|
||||||
networks.each do |network|
|
networks.each do |network|
|
||||||
interfaces.add(network[:interface])
|
interfaces.add(network[:interface])
|
||||||
entries << TemplateRenderer.render("guests/arch/network_#{network[:type]}",
|
entry = TemplateRenderer.render("guests/arch/network_#{network[:type]}",
|
||||||
:options => network)
|
:options => network)
|
||||||
|
|
||||||
|
# Convert to proper line endings
|
||||||
|
entry = dos_to_unix(entry)
|
||||||
|
entries << entry
|
||||||
end
|
end
|
||||||
|
|
||||||
# Perform the careful dance necessary to reconfigure
|
# Perform the careful dance necessary to reconfigure
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
require 'set'
|
require 'set'
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
|
|
||||||
|
require 'vagrant/util/line_ending_helpers'
|
||||||
require 'vagrant/util/template_renderer'
|
require 'vagrant/util/template_renderer'
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
|
@ -8,6 +9,7 @@ module Vagrant
|
||||||
class Debian < Linux
|
class Debian < Linux
|
||||||
# Make the TemplateRenderer top-level
|
# Make the TemplateRenderer top-level
|
||||||
include Vagrant::Util
|
include Vagrant::Util
|
||||||
|
include Vagrant::Util::LineEndingHelpers
|
||||||
|
|
||||||
def configure_networks(networks)
|
def configure_networks(networks)
|
||||||
# First, remove any previous network modifications
|
# First, remove any previous network modifications
|
||||||
|
@ -22,8 +24,12 @@ module Vagrant
|
||||||
entries = []
|
entries = []
|
||||||
networks.each do |network|
|
networks.each do |network|
|
||||||
interfaces.add(network[:interface])
|
interfaces.add(network[:interface])
|
||||||
entries << TemplateRenderer.render("guests/debian/network_#{network[:type]}",
|
entry = TemplateRenderer.render("guests/debian/network_#{network[:type]}",
|
||||||
:options => network)
|
:options => network)
|
||||||
|
|
||||||
|
# Convert line endings properly and save
|
||||||
|
entry = dos_to_unix(entry)
|
||||||
|
entries << entry
|
||||||
end
|
end
|
||||||
|
|
||||||
# Perform the careful dance necessary to reconfigure
|
# Perform the careful dance necessary to reconfigure
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
|
|
||||||
|
require 'vagrant/util/line_ending_helpers'
|
||||||
|
require 'vagrant/util/template_renderer'
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
module Guest
|
module Guest
|
||||||
class Gentoo < Linux
|
class Gentoo < Linux
|
||||||
|
# Make the TemplateRenderer top-level
|
||||||
|
include Vagrant::Util
|
||||||
|
include Vagrant::Util::LineEndingHelpers
|
||||||
|
|
||||||
def configure_networks(networks)
|
def configure_networks(networks)
|
||||||
# Remove any previous host only network additions to the interface file
|
# 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")
|
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]}",
|
entry = TemplateRenderer.render("guests/gentoo/network_#{network[:type]}",
|
||||||
:options => network)
|
:options => network)
|
||||||
|
|
||||||
|
# Convert to proper lineendings
|
||||||
|
entry = dos_to_unix(entry)
|
||||||
|
|
||||||
# Upload the entry to a temporary location
|
# Upload the entry to a temporary location
|
||||||
temp = Tempfile.new("vagrant")
|
temp = Tempfile.new("vagrant")
|
||||||
temp.write(entry)
|
temp.write(entry)
|
||||||
|
|
Loading…
Reference in New Issue