created a much nicer way to deal with IP addresses for downloading
Before it used hostnames from /etc/hosts. Those were annoying because people had
to have them set up and you had to have root permission to change them.
git-svn-id: https://robotics.mvla.net/svn/frc971/2013/trunk/src@4157 f308d9b7-e957-4cde-b6ac-9a88185e7312
diff --git a/aos/build/get_ip b/aos/build/get_ip
new file mode 100755
index 0000000..3b3a569
--- /dev/null
+++ b/aos/build/get_ip
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# This script provides a central location for getting IP addresses. It uses
+# output/ip_base.txt as the first 3 parts and then adds on whatever is
+# correct for its first argument (fitpc or robot).
+# It will create output/ip_base.txt with a default value if it does not already
+# exist.
+
+FILE=`dirname $0`/../../output/ip_base.txt
+
+if [[ ! -e ${FILE} ]]; then
+ mkdir -p `dirname ${FILE}`
+ echo '10.9.71' > ${FILE}
+fi
+
+BASE=`cat ${FILE}`
+
+case $1 in
+ fitpc)
+ # This is the IP address that we use for our fitpc.
+ echo ${BASE}.179 ;;
+ robot)
+ # This is the IP address that the cRIO has to be on.
+ echo ${BASE}.2 ;;
+ *)
+ echo "Unknown IP address $1. Returning ${BASE}.0 instead." 1>&2
+ echo ${BASE}.0
+esac