2010-12-08 20:30:51 +00:00
|
|
|
module Vagrant
|
2011-12-16 05:05:19 +00:00
|
|
|
module Guest
|
2011-01-09 21:09:55 +00:00
|
|
|
class Gentoo < Linux
|
2011-01-11 02:15:55 +00:00
|
|
|
def prepare_host_only_network(net_options=nil)
|
2011-01-09 21:12:57 +00:00
|
|
|
# Remove any previous host only network additions to the
|
|
|
|
# interface file.
|
|
|
|
vm.ssh.execute do |ssh|
|
2012-01-01 03:08:56 +00:00
|
|
|
ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN-HOSTONLY/,/^#VAGRANT-END-HOSTONLY/ d' /etc/conf.d/net > /tmp/vagrant-network-interfaces")
|
2011-01-09 21:12:57 +00:00
|
|
|
ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-interfaces > /etc/conf.d/net'")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-12-08 20:30:51 +00:00
|
|
|
def enable_host_only_network(net_options)
|
2012-01-01 03:08:56 +00:00
|
|
|
entry = TemplateRenderer.render('guests/gentoo/network_hostonly',
|
|
|
|
:net_options => net_options)
|
2010-12-08 20:30:51 +00:00
|
|
|
vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry")
|
|
|
|
|
|
|
|
vm.ssh.execute do |ssh|
|
2011-01-26 22:31:59 +00:00
|
|
|
ssh.exec!("sudo ln -fs /etc/init.d/net.lo /etc/init.d/net.eth#{net_options[:adapter]}")
|
2010-12-08 20:30:51 +00:00
|
|
|
ssh.exec!("sudo /etc/init.d/net.eth#{net_options[:adapter]} stop 2> /dev/null")
|
|
|
|
ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-entry >> /etc/conf.d/net'")
|
|
|
|
ssh.exec!("sudo /etc/init.d/net.eth#{net_options[:adapter]} start")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|