Mercurial > hg > beaglert
changeset 369:75689b7cd57b prerelease
Updated rsync command and command-line options
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Thu, 09 Jun 2016 02:48:58 +0100 |
parents | 4fe4aa2cdfa2 |
children | 137a87b745d2 |
files | scripts/build_project.sh |
diffstat | 1 files changed, 16 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/build_project.sh Thu Jun 09 02:47:38 2016 +0100 +++ b/scripts/build_project.sh Thu Jun 09 02:48:58 2016 +0100 @@ -19,7 +19,7 @@ function usage { THIS_SCRIPT=`basename "$0"` - echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-nfF] <directory-with-source-files>" + echo "Usage: $THIS_SCRIPT [-c command-line-args] [-nbfF] <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 @@ -27,28 +27,25 @@ The source directory should contain at least one .c, .cpp or .S file. 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 -c option passes command-line arguments to the BeagleRT program; enclose the argument string in quotes. By default, the project runs in the foreground of the current terminal, - within a screen session that can be detached later. The -F argument runs + 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. The -f argument runs it + the output can be piped to another destination. The -b argument runs it in a screen in the background, so no output is shown." } OPTIND=1 -while getopts "b:c:nfFhp:" opt; do +while getopts "bc:nfFhp:" opt; do case $opt in - b) BBB_BELA_HOME=$OPTARG - ;; c) COMMAND_ARGS=$OPTARG ;; - f) RUN_IN_FOREGROUND=0 + b) RUN_IN_FOREGROUND=0 ;; - F) RUN_WITHOUT_SCREEN=1 + f) RUN_WITHOUT_SCREEN=1 ;; n) RUN_PROJECT=0 ;; @@ -87,10 +84,9 @@ BBB_PROJECT_FOLDER=$BBB_PROJECT_HOME"/"$BBB_PROJECT_NAME #make sure there is no trailing slash here 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; mkdir -p $BBB_PROJECT_FOLDER; screen -X -S '"$BBB_SCREEN_NAME"' quit &>/dev/null;" +echo "Stopping running process..." +# sets the date and stop running process +ssh $BBB_ADDRESS "date -s '`date`' > /dev/null; mkdir -p $BBB_PROJECT_FOLDER; make -C $BBB_BELA_HOME stop" #concatenate arguments to form path. HOST_SOURCE_PATH= #initially empty, will be filled with input arguments @@ -110,8 +106,12 @@ 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 -ogprv --delete-after --exclude=build $HOST_SOURCE_PATH"/" "$BBB_NETWORK_TARGET_FOLDER/" #trailing slashes used here make sure rsync does not create another folder inside the target folder + #rsync + # --delete makes sure it removes files that are not in the origin folder + # -c evaluates changes using md5 checksum instead of file date, so we don't care about time skews + # --no-t makes sure file timestamps are not preserved, so that the Makefile will not think that targets are up to date when replacing files on the BBB + # with older files from the host. This will solve 99% of the issues with Makefile thinking a target is up to date when it is not. + rsync -avc --no-t --delete-after --exclude=build $HOST_SOURCE_PATH"/" "$BBB_NETWORK_TARGET_FOLDER/" #trailing slashes used here make sure rsync does not create another folder inside the target folder fi; if [ $? -ne 0 ] @@ -131,14 +131,11 @@ if [ $RUN_WITHOUT_SCREEN -ne 0 ] then - echo ssh -t $BBB_ADDRESS "$MAKE_COMMAND run" ssh -t $BBB_ADDRESS "$MAKE_COMMAND run" elif [ $RUN_IN_FOREGROUND -eq 0 ] then - echo ssh $BBB_ADDRESS "$MAKE_COMMAND runscreen" ssh $BBB_ADDRESS "$MAKE_COMMAND runscreen" else - echo ssh -t $BBB_ADDRESS "$MAKE_COMMAND runscreenfg" ssh -t $BBB_ADDRESS "$MAKE_COMMAND runscreenfg" fi fi