Mercurial > hg > beaglert
comparison 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 |
comparison
equal
deleted
inserted
replaced
444:cdf77b9e66bf | 445:2b09be3fb0f2 |
---|---|
1 [ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2" | |
2 [ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/Bela/" | |
3 [ -z "$BBB_SCREEN_NAME" ] && BBB_SCREEN_NAME="Bela" | |
4 [ -z "$RUN_PROJECT" ] && RUN_PROJECT=1 | |
5 [ -z "$COMMAND_ARGS" ] && COMMAND_ARGS= | |
6 [ -z "$RUN_IN_FOREGROUND" ] && RUN_IN_FOREGROUND=1 | |
7 [ -z "$RUN_WITHOUT_SCREEN" ] && RUN_WITHOUT_SCREEN=0 | |
8 [ -z "$BBB_PROJECT_HOME" ] && BBB_PROJECT_HOME="${BBB_BELA_HOME}/projects/" | |
9 [ -z "$BBB_DEFAULT_PROJECT_NAME" ] && BBB_DEFAULT_PROJECT_NAME="scriptUploadedProject" | |
10 [ -z "$BBB_PROJECT_NAME" ] && BBB_PROJECT_NAME=$BBB_DEFAULT_PROJECT_NAME | |
11 | |
12 trap "echo; exit 0;" 2 9 | |
13 folder_has_changed(){ | |
14 [ -z "$2" ] && { echo "Error: folder_has_changed(folder, reference, [filter])"; exit 1; } | |
15 [ -z "$3" ] && FILTER="." || FILTER="$3" | |
16 find "$1" -type f -newer "$2" | grep "$FILTER" | |
17 return $? | |
18 } | |
19 | |
20 wait_for_change(){ | |
21 [ -z "$2" ] && { echo "Error: folder_has_changed(folder, reference, [filter])"; exit 1; } | |
22 [ -z "$4" ] && SLEEP=0.5 || SLEEP="$4" | |
23 while ! folder_has_changed "$1" "$2" "$3" | |
24 do | |
25 sleep $SLEEP; | |
26 done | |
27 } | |
28 | |
29 set_date(){ | |
30 # an optional parameter will be executed as part of the same ssh session | |
31 ssh $BBB_ADDRESS "date -s \"`date '+%Y%m%d %T %Z'`\" > /dev/null; $1" | |
32 } |