#!/bin/bash

echo Warning! I will delete all existing configs!
echo '(sleeping 5 sec to get you a chance to ^C me)'
sleep 5

rm -rf conf
mkdir conf

TEMPLATE=client.conf_template
SERVER_IP='192.168.1.1'
SERVER_PORT=1194


function print_help
{
    echo Usage: $0 range_start range_stop
    echo
    echo See readme.txt for details!
    exit 1;
}

function make_config
{
    sed -e s/%SERVER_IP%/$SERVER_IP/g $TEMPLATE  > tmp1_$1
    sed -e s/%SERVER_PORT%/$SERVER_PORT/g tmp1_$1 > tmp2_$1
    sed -e s/%TEAM%/$1/g tmp2_$1 > conf/$1.conf
    
    rm tmp1_$1
    rm tmp2_$1
}

if [ -z $1 ] ; then print_help ; fi
if [ -z $2 ] ; then print_help ; fi


for i in `seq $1 $2`; do make_config team$i ; done
exit
