Permalink
Browse files

vm: set gateway on init

  • Loading branch information...
1 parent 844f133 commit 6fe36b2d7994e22c329ee591581c4199cf5bdfd5 @niklas niklas committed Jul 27, 2010
Showing with 18 additions and 5 deletions.
  1. +6 −1 recipes/default.rb
  2. +11 −0 templates/default/rootfs/init-net.conf.erb
  3. +1 −4 templates/default/rootfs/init-vm.conf.erb
View
@@ -84,7 +84,7 @@
bash 'remove as many init scripts as possible' do
only_if %Q~test -f #{rootfs}/etc/init/hwclock.conf~
code <<-EOSH
- rm #{rootfs}/etc/init/{hwclock,mount,plymouth,udev}*
+ rm #{rootfs}/etc/init/{hwclock,mount,plymouth,udev,network}*
true
EOSH
end
@@ -104,4 +104,9 @@
source 'rootfs/init-vm.conf.erb'
action :create
end
+
+ template rootfs / 'etc' / 'init' / 'vm-net.conf' do
+ source 'rootfs/init-net.conf.erb'
+ variables :host => node
+ end
end
@@ -0,0 +1,11 @@
+start on startup
+
+# we just fake the network coming up, lxc did this for us
+
+emits net-device-up
+
+script
+ route add default gw <%= @host[:bridge][:ipv4][:address] %>
+ /sbin/initctl emit --no-wait net-device-up IFACE=lo
+ /sbin/initctl emit --no-wait net-device-up IFACE=eth0
+end script
@@ -1,12 +1,9 @@
start on startup
-# we just fake the filesystem and network coming up,lxc did this for us
+# we just fake the filesystem, lxc did this for us
emits filesystem
-emits net-device-up
script
/sbin/initctl emit --no-wait filesystem
- /sbin/initctl emit --no-wait net-device-up IFACE=lo
- /sbin/initctl emit --no-wait net-device-up IFACE=eth0
end script

0 comments on commit 6fe36b2

Please sign in to comment.