#!/bin/bash

REPO="https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/tags/STABLE/phpmyadmin"
LOCATION="/apache/https/t3cluster.rz.uni-greifswald.de/web/phpMyAdmin"

# To actually create the route, we need to extract the DNS entry out of $REPO
# and then resolve it in order to use it with /sbin/route.
DNS="$( dig +short $( echo $REPO | cut -d/ -f3 ) | tail -n 1 )"

# Now here's the plan:
#  (a) add a route to the remote host
#  (b) update $LOCATION
#  (c) remove the route again.

echo "/sbin/route add -net $DNS netmask 255.255.255.255 gw 141.53.5.1"
echo "svn up $LOCATION"
echo "/sbin/route del -net $DNS netmask 255.255.255.255 gw 141.53.5.1"

