giuliomoro@445: [ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2" giuliomoro@445: [ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/Bela/" giuliomoro@445: [ -z "$BBB_SCREEN_NAME" ] && BBB_SCREEN_NAME="Bela" giuliomoro@445: [ -z "$RUN_PROJECT" ] && RUN_PROJECT=1 giuliomoro@445: [ -z "$COMMAND_ARGS" ] && COMMAND_ARGS= giuliomoro@445: [ -z "$RUN_IN_FOREGROUND" ] && RUN_IN_FOREGROUND=1 giuliomoro@445: [ -z "$RUN_WITHOUT_SCREEN" ] && RUN_WITHOUT_SCREEN=0 giuliomoro@445: [ -z "$BBB_PROJECT_HOME" ] && BBB_PROJECT_HOME="${BBB_BELA_HOME}/projects/" giuliomoro@445: [ -z "$BBB_DEFAULT_PROJECT_NAME" ] && BBB_DEFAULT_PROJECT_NAME="scriptUploadedProject" giuliomoro@445: [ -z "$BBB_PROJECT_NAME" ] && BBB_PROJECT_NAME=$BBB_DEFAULT_PROJECT_NAME giuliomoro@445: giuliomoro@445: trap "echo; exit 0;" 2 9 giuliomoro@445: folder_has_changed(){ giuliomoro@445: [ -z "$2" ] && { echo "Error: folder_has_changed(folder, reference, [filter])"; exit 1; } giuliomoro@445: [ -z "$3" ] && FILTER="." || FILTER="$3" giuliomoro@445: find "$1" -type f -newer "$2" | grep "$FILTER" giuliomoro@445: return $? giuliomoro@445: } giuliomoro@445: giuliomoro@445: wait_for_change(){ giuliomoro@445: [ -z "$2" ] && { echo "Error: folder_has_changed(folder, reference, [filter])"; exit 1; } giuliomoro@445: [ -z "$4" ] && SLEEP=0.5 || SLEEP="$4" giuliomoro@445: while ! folder_has_changed "$1" "$2" "$3" giuliomoro@445: do giuliomoro@445: sleep $SLEEP; giuliomoro@445: done giuliomoro@445: } giuliomoro@445: giuliomoro@445: set_date(){ giuliomoro@445: # an optional parameter will be executed as part of the same ssh session giuliomoro@445: ssh $BBB_ADDRESS "date -s \"`date '+%Y%m%d %T %Z'`\" > /dev/null; $1" giuliomoro@445: }