Mercurial > hg > beaglert
comparison scripts/run_project.sh @ 425:99de323c13b3 prerelease
Scripts use sh instead of bash. Some fixes in run_project and build_project
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Thu, 16 Jun 2016 15:55:03 +0100 |
parents | a430a16d2c02 |
children | 2e01a9d6cb58 |
comparison
equal
deleted
inserted
replaced
424:9614e2f4b76e | 425:99de323c13b3 |
---|---|
1 #!/bin/bash | 1 #!/bin/sh |
2 # | 2 # |
3 # This script runs an already-compiled Bela project on the | 3 # This script runs an already-compiled Bela project on the |
4 # BeagleBone Black. | 4 # BeagleBone Black. |
5 | 5 |
6 [ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2" | 6 [ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2" |
18 THIS_SCRIPT=`basename "$0"` | 18 THIS_SCRIPT=`basename "$0"` |
19 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-fF]" | 19 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-fF]" |
20 | 20 |
21 echo " | 21 echo " |
22 This script runs a previously compiled Bela project on the | 22 This script runs a previously compiled Bela project on the |
23 BeagleBone Black. The -b option changes the default path, which | 23 BeagleBone Black. The -c option passes command-line arguments |
24 is otherwise $BBB_BELA_HOME. The -c option passes command-line arguments | |
25 to the Bela program; enclose the argument string in quotes. | 24 to the Bela program; enclose the argument string in quotes. |
25 | |
26 -p arg : sets the name of the project to run (default: $BBB_PROJECT_NAME ) | |
26 | 27 |
27 The -f argument runs the project in the foreground of the current terminal, | 28 By default, the project runs in the foreground of the current terminal, |
28 within a screen session that can be detached later. The -F argument runs | 29 within a screen session that can be detached later. The -f argument runs |
29 the project in the foreground of the current terminal, without screen, so | 30 the project in the foreground of the current terminal, without screen, so |
30 the output can be piped to another destination." | 31 the output can be piped to another destination. The -b argument runs it |
32 in a screen in the background, so no output is shown. The -m argument allows | |
33 to pass arguments to the Makefile before the run target. For instance, | |
34 pass -m \`"projectclean"\` or \`-m "distclean"\` to clean project-specific | |
35 pre-built objects, or all the pre-built objects, respectively." | |
31 } | 36 } |
32 | 37 |
33 OPTIND=1 | 38 OPTIND=1 |
34 | 39 |
35 while getopts "b:c:fFh" opt; do | 40 while getopts "bc:m:nfFhp:" opt; do |
36 case $opt in | 41 case $opt in |
37 b) BBB_BELA_HOME=$OPTARG | |
38 ;; | |
39 c) COMMAND_ARGS=$OPTARG | 42 c) COMMAND_ARGS=$OPTARG |
40 ;; | 43 ;; |
41 f) RUN_IN_FOREGROUND=1 | 44 b) RUN_IN_FOREGROUND=0 |
42 ;; | 45 ;; |
43 F) RUN_WITHOUT_SCREEN=1 | 46 f) RUN_WITHOUT_SCREEN=1 |
44 ;; | 47 ;; |
48 p) BBB_PROJECT_NAME=$OPTARG | |
49 ;; | |
50 m) BBB_MAKEFILE_OPTIONS=$OPTARG | |
51 ;; | |
45 h|\?) usage | 52 h|\?) usage |
46 exit 1 | 53 exit 1 |
47 esac | 54 esac |
48 done | 55 done |
49 | 56 |
54 BBB_PROJECT_NAME=$BBB_DEFAULT_PROJECT_NAME | 61 BBB_PROJECT_NAME=$BBB_DEFAULT_PROJECT_NAME |
55 else | 62 else |
56 BBB_PROJECT_NAME=$1 | 63 BBB_PROJECT_NAME=$1 |
57 fi | 64 fi |
58 | 65 |
59 MAKE_COMMAND="make stop -C $BBB_BELA_HOME PROJECT='$BBB_PROJECT_NAME' CL='$COMMAND_ARGS'" | 66 MAKE_COMMAND="make --no-print-directory stop -C $BBB_BELA_HOME PROJECT='$BBB_PROJECT_NAME' CL='$COMMAND_ARGS'" |
60 echo "Running $BBB_PROJECT_NAME..." | 67 echo "Running $BBB_PROJECT_NAME..." |
61 if [ $RUN_WITHOUT_SCREEN -ne 0 ] | 68 if [ $RUN_WITHOUT_SCREEN -eq 1 ] |
62 then | 69 then |
63 ssh $BBB_ADDRESS "$MAKE_COMMAND run" | 70 ssh -t $BBB_ADDRESS "$MAKE_COMMAND run" |
64 elif [ $RUN_IN_FOREGROUND -eq 0 ] | 71 elif [ $RUN_IN_FOREGROUND -eq 1 ] |
65 then | 72 then |
66 ssh $BBB_ADDRESS "$MAKE_COMMAND runscreenfg" | 73 ssh -t $BBB_ADDRESS "$MAKE_COMMAND runscreenfg" |
67 else | 74 else |
68 ssh $BBB_ADDRESS "$MAKE_COMMAND runscreen" | 75 ssh $BBB_ADDRESS "$MAKE_COMMAND runscreen" |
69 fi | 76 fi |