Mercurial > hg > beaglert
changeset 90:c74006ef86ca
Added foreground run option to build script
author | andrewm |
---|---|
date | Sun, 19 Jul 2015 16:42:51 +0100 |
parents | d41631e0fe0e |
children | 241d4d5df929 |
files | scripts/build_project.sh |
diffstat | 1 files changed, 24 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/build_project.sh Sun Jul 19 16:15:28 2015 +0100 +++ b/scripts/build_project.sh Sun Jul 19 16:42:51 2015 +0100 @@ -8,11 +8,13 @@ BBB_PATH="~/BeagleRT" RUN_PROJECT=1 COMMAND_ARGS= +RUN_IN_FOREGROUND=0 +RUN_WITHOUT_SCREEN=0 function usage { THIS_SCRIPT=`basename "$0"` - echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-n] <directory-with-source-files>" + echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-nfF] <directory-with-source-files>" echo " This script copies a directory of source files to the BeagleBone, compiles and runs it. The BeagleRT core files should have first been copied over @@ -22,17 +24,26 @@ If the argument -n is passed, the output will not be run after compiling. The argument -b will change the local path on the BeagleBone where the BeagleRT files are found. The -c option passes command-line arguments to - the BeagleRT program; enclose the argument string in quotes." + the BeagleRT program; enclose the argument string in quotes. + + The -f argument runs the project in the foreground of the current terminal, + within a screen session that can be detached later. The -F argument runs + the project in the foreground of the current terminal, without screen, so + the output can be piped to another destination." } OPTIND=1 -while getopts "b:c:nh" opt; do +while getopts "b:c:nfFh" opt; do case $opt in b) BBB_PATH=$OPTARG ;; c) COMMAND_ARGS=$OPTARG ;; + f) RUN_IN_FOREGROUND=1 + ;; + F) RUN_WITHOUT_SCREEN=1 + ;; n) RUN_PROJECT=0 ;; h|\?) usage @@ -100,5 +111,14 @@ ssh $BBB_ADDRESS "make all -C $BBB_PATH" else echo "Building and running project..." - ssh $BBB_ADDRESS "make all -C $BBB_PATH && screen -S BeagleRT -d -m $BBB_PATH/BeagleRT $COMMAND_ARGS" + + if [ $RUN_WITHOUT_SCREEN -ne 0 ] + then + ssh -t $BBB_ADDRESS "make all -C $BBB_PATH && $BBB_PATH/BeagleRT $COMMAND_ARGS" + elif [ $RUN_IN_FOREGROUND -eq 0 ] + then + ssh $BBB_ADDRESS "make all -C $BBB_PATH && screen -S BeagleRT -d -m $BBB_PATH/BeagleRT $COMMAND_ARGS" + else + ssh -t $BBB_ADDRESS "make all -C $BBB_PATH && screen -S BeagleRT $BBB_PATH/BeagleRT $COMMAND_ARGS" + fi fi \ No newline at end of file