Sbot scripts

From IridiaWiki
Jump to navigationJump to search

Safely send files to sbots

A script provided by Kevin Frugier, from EPFL.

Usage : ./give.sh sbot10 pic*.bmp

Remark : binaries are stripped using a specific tool, take care of the line yourself :-)

#!/bin/sh
if [ $# -lt 2 ]
then
echo "usage : $0 [robot_name] [file1] [file2] [file...]"
exit 1
fi

robot=$1

for id_file in $(seq 2 $#)
  do
  shift
  echo "[$1]"
  echo "Striping (it can fail if it is not an arm binary)"
  /usr/arm/arm-linux/bin/strip $1
  echo "Spliting"
  split $1 $1.part -a 3 -b 100k -d &&
  echo "Transfering .part files"
  scp $1.part* root@$robot:. &&
  echo "Removing local .part files"
  rm $1.part*
  echo "Concatening distant .part files"
  ssh root@$robot "cat $1.part* > $1" &&
  echo "Removing distant .part files"
  ssh root@$robot "rm $1.part*"
done