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/.gitignore b/.gitignore
index e1e921c..77bd705 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
out_atom/
out_crio/
+output/
diff --git a/aos/build/build.sh b/aos/build/build.sh
index 7c0362b..60be0dd 100755
--- a/aos/build/build.sh
+++ b/aos/build/build.sh
@@ -69,9 +69,9 @@
[ ${PLATFORM} == atom ] && \
rsync --progress -t -r --rsync-path=/home/driver/bin/rsync \
${OUTDIR}/Default/outputs/* \
- driver@fitpc:/home/driver/robot_code/bin
+ driver@`${AOS}/build/get_ip fitpc`:/home/driver/robot_code/bin
[ ${PLATFORM} == crio ] && \
- ncftpput robot / \
+ ncftpput `${AOS}/build/get_ip robot` / \
${OUTDIR}/Default/lib/FRC_UserProgram.out
;;
tests)
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
diff --git a/doc/building-the-code.txt b/doc/building-the-code.txt
index 7967563..2d68389 100644
--- a/doc/building-the-code.txt
+++ b/doc/building-the-code.txt
@@ -27,11 +27,7 @@
Squeeze), then
(1) do `apt-get install ncftp rsync socat`.
socat is used for the netconsole.sh tool that is used to talk to the cRIO.
- (2) Add robot and the following to the /etc/hosts file. This requirement
- should go away in the future.
- 10.9.71.179 fitpc
- 10.9.71.2 robot
- (3) Set the IP address of the downloading machine to be on the same subnet.
+ (2) Set the IP address of the downloading machine to be on the same subnet.
ifconfig eth0 10.9.71.22
This will need to be redone when the computer Ethernet connection is
reset. For example, it is reset by disconnecting and reconnecting