annotate scripts/.bela_common @ 445:2b09be3fb0f2 prerelease

Re-implemented watch for build_heavy ... added .bela_common file for shared config and utilities
author Giulio Moro <giuliomoro@yahoo.it>
date Sun, 19 Jun 2016 03:28:53 +0100
parents
children 86591d203c78
rev   line source
giuliomoro@445 1 [ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2"
giuliomoro@445 2 [ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/Bela/"
giuliomoro@445 3 [ -z "$BBB_SCREEN_NAME" ] && BBB_SCREEN_NAME="Bela"
giuliomoro@445 4 [ -z "$RUN_PROJECT" ] && RUN_PROJECT=1
giuliomoro@445 5 [ -z "$COMMAND_ARGS" ] && COMMAND_ARGS=
giuliomoro@445 6 [ -z "$RUN_IN_FOREGROUND" ] && RUN_IN_FOREGROUND=1
giuliomoro@445 7 [ -z "$RUN_WITHOUT_SCREEN" ] && RUN_WITHOUT_SCREEN=0
giuliomoro@445 8 [ -z "$BBB_PROJECT_HOME" ] && BBB_PROJECT_HOME="${BBB_BELA_HOME}/projects/"
giuliomoro@445 9 [ -z "$BBB_DEFAULT_PROJECT_NAME" ] && BBB_DEFAULT_PROJECT_NAME="scriptUploadedProject"
giuliomoro@445 10 [ -z "$BBB_PROJECT_NAME" ] && BBB_PROJECT_NAME=$BBB_DEFAULT_PROJECT_NAME
giuliomoro@445 11
giuliomoro@445 12 trap "echo; exit 0;" 2 9
giuliomoro@445 13 folder_has_changed(){
giuliomoro@445 14 [ -z "$2" ] && { echo "Error: folder_has_changed(folder, reference, [filter])"; exit 1; }
giuliomoro@445 15 [ -z "$3" ] && FILTER="." || FILTER="$3"
giuliomoro@445 16 find "$1" -type f -newer "$2" | grep "$FILTER"
giuliomoro@445 17 return $?
giuliomoro@445 18 }
giuliomoro@445 19
giuliomoro@445 20 wait_for_change(){
giuliomoro@445 21 [ -z "$2" ] && { echo "Error: folder_has_changed(folder, reference, [filter])"; exit 1; }
giuliomoro@445 22 [ -z "$4" ] && SLEEP=0.5 || SLEEP="$4"
giuliomoro@445 23 while ! folder_has_changed "$1" "$2" "$3"
giuliomoro@445 24 do
giuliomoro@445 25 sleep $SLEEP;
giuliomoro@445 26 done
giuliomoro@445 27 }
giuliomoro@445 28
giuliomoro@445 29 set_date(){
giuliomoro@445 30 # an optional parameter will be executed as part of the same ssh session
giuliomoro@445 31 ssh $BBB_ADDRESS "date -s \"`date '+%Y%m%d %T %Z'`\" > /dev/null; $1"
giuliomoro@445 32 }