comparison scripts/set_startup.sh @ 509:3bb63b848960 prerelease

set_startup defaults to loop mode
author Giulio Moro <giuliomoro@yahoo.it>
date Wed, 22 Jun 2016 03:28:07 +0100
parents d9a4fc5357e7
children
comparison
equal deleted inserted replaced
508:a85851bb2e10 509:3bb63b848960
6 SCRIPTDIR=$(dirname "$0") 6 SCRIPTDIR=$(dirname "$0")
7 [ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/ 7 [ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/
8 . $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; } 8 . $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; }
9 9
10 ENABLE_STARTUP=1 10 ENABLE_STARTUP=1
11 RUN_IN_LOOP=0 11 RUN_IN_LOOP=1
12 12
13 # This path is hard-coded in the Bela image at present. 13 # This path is hard-coded in the Bela image at present.
14 14
15 usage() 15 usage()
16 { 16 {
17 THIS_SCRIPT=`basename "$0"` 17 THIS_SCRIPT=`basename "$0"`
18 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-n] [-l]" 18 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-n] [-s]"
19 19
20 echo " 20 echo "
21 This script enables (by default) or disables running the Bela 21 This script enables (by default) or disables running the Bela
22 project at startup. The -n option disables auto-startup, otherwise 22 project at startup. The -n option disables auto-startup, otherwise
23 auto-startup is enabled. The -b option changes the name of the project to 23 auto-startup is enabled. The -b option changes the name of the project to
24 set on startup, which is otherwise $BBB_DEFAULT_PROJECT_NAME. The -c option 24 set on startup, which is otherwise $BBB_DEFAULT_PROJECT_NAME. The -c option
25 passes command-line arguments to the Bela program; enclose the argument 25 passes command-line arguments to the Bela program; enclose the argument
26 string in quotes. 26 string in quotes.
27 The -l option runs the Bela program in a loop, restarting 27 The -s option runs the Bela program in single-shot mode.
28 automatically in the event of a crash." 28 By default, instead, the program is restarted automatically in the event of a crash."
29 } 29 }
30 30
31 OPTIND=1 31 OPTIND=1
32 32
33 while getopts "b:c:nlh" opt; do 33 while getopts "b:c:nhs" opt; do
34 case $opt in 34 case $opt in
35 b) BBB_PROJECT_NAME=$OPTARG 35 b) BBB_PROJECT_NAME=$OPTARG
36 ;; 36 ;;
37 c) COMMAND_ARGS=$OPTARG 37 c) COMMAND_ARGS=$OPTARG
38 ;; 38 ;;
39 n) ENABLE_STARTUP=0 39 n) ENABLE_STARTUP=0
40 ;; 40 ;;
41 l) RUN_IN_LOOP=1 41 s) RUN_IN_LOOP=0
42 ;; 42 ;;
43 h|\?) usage 43 h|\?) usage
44 exit 1 44 exit 1
45 esac 45 esac
46 done 46 done