Mercurial > hg > beaglert
annotate scripts/.bela_common @ 456:aa3f38d8a9b6 prerelease
using relative links in examples/core
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 20 Jun 2016 01:10:16 +0100 |
parents | 86591d203c78 |
children | 03b511d99f3d |
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@447 | 14 [ -z "$2" ] && { echo "Error: folder_has_changed(folder, reference, [filter])"; return 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@447 | 21 [ -z "$2" ] && { echo "Error: folder_has_changed(folder, reference, [filter])"; return 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 } |