listconfigure.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. listfile=$1
  3. owner=$2
  4. peersdir=$3
  5. if [ -z "$listfile" -o -z "$owner" -o -z "$peersdir" ]; then
  6. echo "USAGE: $0 <listfile> <owner> <peers-dir>"
  7. echo "<listfile> is a list containing lines of the format 'name' or 'name=lat lon'"
  8. echo "<owner> is a free text which will be embedded into the peers git"
  9. echo "<peersdir> is the path to the peers git's working copy"
  10. exit 1
  11. fi
  12. if [ ! -r "$listfile" ]; then
  13. echo "The listfile is not readable (does it exist?)."
  14. exit 2
  15. fi
  16. if [ ! -d "$peersdir" ]; then
  17. echo "The peers dir does not exist."
  18. exit 2
  19. fi
  20. cat $listfile | while read line; do
  21. [ -z "$line" ] && continue
  22. name=`echo $line | cut -d"=" -f 1`
  23. latlon=`echo $line | cut -d"=" -f 2 | awk '{print $1" "$2}'`
  24. echo "Next node: $name at $latlon"
  25. echo -n "Waiting for an uncofigured router to appear on 192.168.1.1 ..."
  26. while ! ping -n -c 1 -W 1 192.168.1.1 > /dev/null; do
  27. echo -n "."
  28. sleep 1
  29. done
  30. echo " found."
  31. echo "Waiting for router to come up completly (waiting 15 Seconds)"
  32. sleep 15
  33. echo "Let the show begin ..."
  34. ./configure-node.sh $name $owner $latlon > "${peersdir}/${name}"
  35. done