#!/bin/sh # This script must be run as root and sets up Mac OS X to route all .kite domains to the virtual box VM with the name # 'boot2docker-vm'. It does the following: # 1) Adds a file under /etc/resolver/kite # 2) Sets up a LaunchAgent for adding entries to the route table to route all requests to the Docker subnet (172.17.0.0/16) # And expects the $IFNAME variable to contain the interface on which to send traffic to the boot2docker VM. mkdir -p /etc/resolver echo "nameserver 172.17.42.1" > /etc/resolver/kite DIR=$(dirname "$0") USER=`w -h | sort -u -t' ' -k1,1 | awk '{print $1}'` /bin/rm -rf /Library/LaunchAgents/com.kitematic.route.plist echo " Label com.kitematic.route ProgramArguments bash -c /usr/sbin/scutil -w State:/Network/Interface/$IFNAME/IPv4;/sbin/route -n add -net 172.17.0.0 -netmask 255.255.0.0 -gateway $GATEWAY KeepAlive RunAtLoad LaunchOnlyOnce " > /Library/LaunchAgents/com.kitematic.route.plist # Add entries to routing table for Kitematic VM /sbin/route delete -net 172.17.0.0 -netmask 255.255.0.0 -gateway $GATEWAY > /dev/null 2>&1 || true /sbin/route -n add -net 172.17.0.0 -netmask 255.255.0.0 -gateway $GATEWAY