blob: d798884cef7a8cc02a80f26a0ad7eb06b460f862 [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
Brian Silverman14fd0fb2014-01-14 21:42:01 -08005# correct for its first argument (prime or robot).
brians261847b2013-02-26 01:56:51 +00006# 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
Brian Silverman14fd0fb2014-01-14 21:42:01 -080019 prime)
20 # This is the IP address that we use for the prime.
brians261847b2013-02-26 01:56:51 +000021 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