Mercurial > hg > beaglert
changeset 332:ccd084cf22ac prerelease
run_project takes parameter for project name (defaults to scriptUploadedProject)
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sat, 04 Jun 2016 16:23:40 +0100 |
parents | cfdf0003e6e8 |
children | 4edf9a840a2a |
files | scripts/run_project.sh |
diffstat | 1 files changed, 25 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/run_project.sh Sat Jun 04 16:17:06 2016 +0100 +++ b/scripts/run_project.sh Sat Jun 04 16:23:40 2016 +0100 @@ -3,11 +3,15 @@ # This script runs an already-compiled BeagleRT project on the # BeagleBone Black. -BBB_ADDRESS="root@192.168.7.2" -BBB_PATH="~/BeagleRT" -COMMAND_ARGS= -RUN_IN_FOREGROUND=0 -RUN_WITHOUT_SCREEN=0 +[ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2" +[ -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 "$BBB_PROJECT_HOME" ] && BBB_PROJECT_HOME="${BBB_BELA_HOME}/projects/" +[ -z "$BBB_DEFAULT_PROJECT_NAME" ] && BBB_DEFAULT_PROJECT_NAME="scriptUploadedProject" function usage { @@ -17,7 +21,7 @@ echo " This script runs a previously compiled BeagleRT project on the BeagleBone Black. The -b option changes the default path, which - is otherwise $BBB_PATH. The -c option passes command-line arguments + is otherwise $BBB_BELA_HOME. The -c option passes command-line arguments to the BeagleRT program; enclose the argument string in quotes. The -f argument runs the project in the foreground of the current terminal, @@ -30,28 +34,36 @@ while getopts "b:c:fFh" opt; do case $opt in - b) BBB_PATH=$OPTARG + b) BBB_BELA_HOME=$OPTARG ;; c) COMMAND_ARGS=$OPTARG ;; f) RUN_IN_FOREGROUND=1 ;; - F) RUN_WITHOUT_SCREEN=1 + F) RUN_WITHOUT_SCREEN=1 ;; h|\?) usage exit 1 esac done +if [ -z "$1" ] +then + BBB_PROJECT_NAME=$BBB_DEFAULT_PROJECT_NAME +else + BBB_PROJECT_NAME=$1 +fi + shift $((OPTIND-1)) -echo "Running BeagleRT..." +MAKE_COMMAND="make stop -C $BBB_BELA_HOME PROJECT='$BBB_PROJECT_NAME' CL='$COMMAND_ARGS'" +echo "Running $BBB_PROJECT_NAME..." if [ $RUN_WITHOUT_SCREEN -ne 0 ] then - ssh -t $BBB_ADDRESS "screen -X -S BeagleRT quit &>/dev/null; pkill BeagleRT ; sleep 0.5 ; $BBB_PATH/BeagleRT $COMMAND_ARGS" + ssh -t $BBB_ADDRESS "$MAKE_COMMAND run" elif [ $RUN_IN_FOREGROUND -eq 0 ] then - ssh $BBB_ADDRESS "screen -X -S BeagleRT quit &>/dev/null; pkill BeagleRT ; sleep 0.5 ; screen -S BeagleRT -d -m $BBB_PATH/BeagleRT $COMMAND_ARGS" + ssh $BBB_ADDRESS "$MAKE_COMMAND runscreenfg" else - ssh -t $BBB_ADDRESS "screen -X -S BeagleRT quit &>/dev/null; pkill BeagleRT ; sleep 0.5 ; screen -S BeagleRT $BBB_PATH/BeagleRT $COMMAND_ARGS" -fi \ No newline at end of file + ssh -t $BBB_ADDRESS "$MAKE_COMMAND runscreen" +fi