listflash.sh 801 B

1234567891011121314151617181920212223242526272829303132
  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`
  24. echo "$name { $latlon }"
  25. ./configure-node.sh $name $owner $latlon > "${peersdir}/${name}"
  26. done