blob: 3b3a5692a60665d4ac16d9c9a610cc7226bddeb0 [file] [log] [blame]
brians261847b2013-02-26 01:56:51 +00001#!/bin/bash
2
3# This script provides a central location for getting IP addresses. It uses
4# output/ip_base.txt as the first 3 parts and then adds on whatever is
5# correct for its first argument (fitpc or robot).
6# It will create output/ip_base.txt with a default value if it does not already
7# exist.
8
9FILE=`dirname $0`/../../output/ip_base.txt
10
11if [[ ! -e ${FILE} ]]; then
12 mkdir -p `dirname ${FILE}`
13 echo '10.9.71' > ${FILE}
14fi
15
16BASE=`cat ${FILE}`
17
18case $1 in
19 fitpc)
20 # This is the IP address that we use for our fitpc.
21 echo ${BASE}.179 ;;
22 robot)
23 # This is the IP address that the cRIO has to be on.
24 echo ${BASE}.2 ;;
25 *)
26 echo "Unknown IP address $1. Returning ${BASE}.0 instead." 1>&2
27 echo ${BASE}.0
28esac