Sha256: 1400af4f18992d5c721e29b70b738c87b2464c6fb031ccd18d9af854904d1435

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

#!/bin/sh -e
# Provision routes on Vagrant controled interfaces.
#
# We can't do this in `/etc/networks/interfaces` because Vagrant doesn't support
# adding arbritrary commands to its generated interfaces. This sucks, because it
# means we have to hardcore the device names and the user has to guess them from
# the order of the network definitions. The alternative to this is to run the ip
# commands on every boot, which is arguably even worse.
#
# TODO found out `private_network` takes an `auto_config => false` which allows
# doing the `/etc/networks/interfaces` entry ourselves.
#
# TODO Send a patch to Vagrant core allowing specifying arbritrary network
# interface parameters to the definitions. An example syntax could be:
#
#   config.vm.network :private_network, ip: "...", netmask: "...",
#     interface: { up: "ip route add .. via .." }
#
# `iptool` commands don't need to specify the interface when they're part of of
# the network hooks in the interface.

if [ "$MODE" != start ]; then
  exit 0
fi

if [ "$IFACE" != eth1 ]; then
  exit 0
fi

<% routes.each do |route| %>
ip route add <%= route.to_cidr %> via <%= gateway.overlapping_subnets(self).first %> dev eth1 || true
<% end %>

exit 0

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-clusterfuck-0.0.1 templates/routes.sh.erb