Mercurial > hg > beaglert
changeset 266:156191dffa8c prerelease
build_projecy.sh: copy files by default to projects/scriptUploadedProject, uses new Makefile
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Tue, 17 May 2016 14:07:01 +0100 |
parents | 4989afa8e994 |
children | 247a182adb6d |
files | scripts/build_project.sh |
diffstat | 1 files changed, 14 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/build_project.sh Mon May 16 16:26:38 2016 +0100 +++ b/scripts/build_project.sh Tue May 17 14:07:01 2016 +0100 @@ -6,14 +6,14 @@ # set defaults unless variables are already set [ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2" -[ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/Bela/" +[ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/BeagleRT/" +[ -z "$BBB_SCREEN_NAME" ] && BBB_SCREEN_NAME="BeagleRT" [ -z "$RUN_PROJECT" ] && RUN_PROJECT=1 [ -z "$COMMAND_ARGS" ] && COMMAND_ARGS= [ -z "$RUN_IN_FOREGROUND" ] && RUN_IN_FOREGROUND=1 [ -z "$RUN_WITHOUT_SCREEN" ] && RUN_WITHOUT_SCREEN=0 -[ -z "$SCREEN_NAME" ] && SCREEN_NAME=Bela [ -z "$BBB_PROJECT_HOME" ] && BBB_PROJECT_HOME="${BBB_BELA_HOME}/projects/" -[ -x "$BBB_PROJECT_NAME" ] && BBB_PROJECT_NAME="scriptUploadedProject" +[ -z "$BBB_PROJECT_NAME" ] && BBB_PROJECT_NAME="scriptUploadedProject" function usage { @@ -81,10 +81,13 @@ exit fi +BBB_PROJECT_FOLDER=$BBB_PROJECT_HOME"/"$BBB_PROJECT_NAME"/" +BBB_NETWORK_TARGET_FOLDER=$BBB_ADDRESS:$BBB_PROJECT_FOLDER + # Stop BeagleRT and clean out old source files echo "Stopping running program..." # sets the date, stops the running process -ssh $BBB_ADDRESS "date -s '`date`' > /dev/null; screen -X -S '"$SCREEN_NAME"' quit &>/dev/null;" +ssh $BBB_ADDRESS "date -s '`date`' > /dev/null; mkdir -p $BBB_PROJECT_FOLDER; screen -X -S '"$BBB_SCREEN_NAME"' quit &>/dev/null;" #concatenate arguments to form path. HOST_SOURCE_PATH= #initially empty, will be filled with input arguments @@ -101,11 +104,11 @@ then #if rsync is not available, brutally clean the destination folder #and copy over all the files again and recompile them - ssh bbb "make -C $BBB_BELA_HOME sourceclean"; - scp $HOST_SOURCE_PATH "$BBB_ADDRESS:$BBB_BELA_HOME/source/" + ssh bbb "make -C $BBB_BELA_HOME sourceclean PROJECT=$BBB_PROJECT_NAME"; + scp $HOST_SOURCE_PATH "$BBB_NETWORK_TARGET_FOLDER" else #rsync --delete makes sure it removes files that are not in the origin folder - rsync -av --delete-after $HOST_SOURCE_PATH "$BBB_ADDRESS:$BBB_BELA_HOME/source/" + rsync -av --delete-after --exclude=build $HOST_SOURCE_PATH "$BBB_NETWORK_TARGET_FOLDER" fi; if [ $? -ne 0 ] @@ -118,17 +121,17 @@ if [ $RUN_PROJECT -eq 0 ] then echo "Building project..." - ssh $BBB_ADDRESS "make all -C $BBB_BELA_HOME" + ssh $BBB_ADDRESS "make all -C $BBB_BELA_HOME PROJECT=$BBB_PROJECT_NAME" else echo "Building and running project..." if [ $RUN_WITHOUT_SCREEN -ne 0 ] then - ssh -t $BBB_ADDRESS "cd $BBB_BELA_HOME && make all && cd source && ../BeagleRT $COMMAND_ARGS" + ssh -t $BBB_ADDRESS "cd $BBB_BELA_HOME && make all && cd source && $BBB_PROJECT_FOLDER/$BBB_PROJECT_NAME $COMMAND_ARGS" elif [ $RUN_IN_FOREGROUND -eq 0 ] then - ssh $BBB_ADDRESS "cd $BBB_BELA_HOME && make all && cd source && screen -S $SCREEN_NAME -d -m ../BeagleRT $COMMAND_ARGS" + ssh $BBB_ADDRESS "cd $BBB_BELA_HOME && make all PROJECT=$BBB_PROJECT_NAME && cd source && screen -S $BBB_SCREEN_NAME -d -m $BBB_PROJECT_FOLDER/$BBB_PROJECT_NAME $COMMAND_ARGS" else - ssh -t $BBB_ADDRESS "cd $BBB_BELA_HOME && make all && cd source && screen -S $SCREEN_NAME ../BeagleRT $COMMAND_ARGS" + ssh -t $BBB_ADDRESS "cd $BBB_BELA_HOME && make all PROJECT=$BBB_PROJECT_NAME && cd source && screen -S $BBB_SCREEN_NAME $BBB_PROJECT_FOLDER/$BBB_PROJECT_NAME $COMMAND_ARGS" fi fi