Mercurial > hg > beaglert
annotate scripts/set_startup.sh @ 269:ac8eb07afcf5
Oxygen text added to each render.cpp file for the default projects. Text includes project explanation from Wiki, edited in places.
Empty project added as a default project.
Doxyfile updated. Each of the project locations added to INPUT configuration option. Consider just watching the whole project file so all new projects are automatically pulled through.
author | Robert Jack <robert.h.jack@gmail.com> |
---|---|
date | Tue, 17 May 2016 15:40:16 +0100 |
parents | a11e23f4e6af |
children | abd7795dad5d |
rev | line source |
---|---|
andrewm@59 | 1 #!/bin/bash |
andrewm@59 | 2 # |
andrewm@59 | 3 # This script enables or disables running BeagleRT when the board starts |
andrewm@59 | 4 # up. |
andrewm@59 | 5 |
andrewm@59 | 6 BBB_ADDRESS="root@192.168.7.2" |
andrewm@59 | 7 BBB_PATH="/root/BeagleRT" |
andrewm@59 | 8 ENABLE_STARTUP=1 |
andrewm@60 | 9 COMMAND_ARGS= |
andrewm@62 | 10 RUN_IN_LOOP=0 |
andrewm@59 | 11 |
andrewm@59 | 12 # This path is hard-coded in the BeagleRT image at present. |
andrewm@59 | 13 BBB_STARTUP_SCRIPT="/root/BeagleRT_startup.sh" |
andrewm@59 | 14 |
andrewm@59 | 15 function usage |
andrewm@59 | 16 { |
andrewm@59 | 17 THIS_SCRIPT=`basename "$0"` |
andrewm@62 | 18 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-n] [-l]" |
andrewm@59 | 19 |
andrewm@59 | 20 echo " |
andrewm@59 | 21 This script enables (by default) or disables running the BeagleRT |
andrewm@59 | 22 project at startup. The -n option disables auto-startup, otherwise |
andrewm@59 | 23 auto-startup is enabled. The -b option changes the default path, which |
andrewm@60 | 24 is otherwise $BBB_PATH. The -c option passes command-line arguments to |
andrewm@62 | 25 the BeagleRT program; enclose the argument string in quotes. |
andrewm@62 | 26 The -l option runs the BeagleRT program in a loop, restarting |
andrewm@62 | 27 automatically in the event of a crash." |
andrewm@59 | 28 } |
andrewm@59 | 29 |
andrewm@59 | 30 OPTIND=1 |
andrewm@59 | 31 |
andrewm@62 | 32 while getopts "b:c:nlh" opt; do |
andrewm@59 | 33 case $opt in |
andrewm@59 | 34 b) BBB_PATH=$OPTARG |
andrewm@59 | 35 ;; |
andrewm@60 | 36 c) COMMAND_ARGS=$OPTARG |
andrewm@60 | 37 ;; |
andrewm@59 | 38 n) ENABLE_STARTUP=0 |
andrewm@59 | 39 ;; |
andrewm@62 | 40 l) RUN_IN_LOOP=1 |
andrewm@62 | 41 ;; |
andrewm@59 | 42 h|\?) usage |
andrewm@59 | 43 exit 1 |
andrewm@59 | 44 esac |
andrewm@59 | 45 done |
andrewm@59 | 46 |
andrewm@59 | 47 shift $((OPTIND-1)) |
andrewm@59 | 48 |
andrewm@59 | 49 if [ $ENABLE_STARTUP -eq 0 ] |
andrewm@59 | 50 then |
andrewm@59 | 51 echo "Disabling BeagleRT at startup..." |
andrewm@59 | 52 |
andrewm@59 | 53 ssh $BBB_ADDRESS "echo \"#!/bin/sh |
andrewm@59 | 54 # |
andrewm@59 | 55 # This file is autogenerated by BeagleRT. Do not edit! |
andrewm@59 | 56 |
andrewm@59 | 57 # Run on startup disabled -- nothing to do here\" > $BBB_STARTUP_SCRIPT" |
andrewm@59 | 58 |
andrewm@59 | 59 else |
andrewm@59 | 60 echo "Enabling BeagleRT at startup..." |
andrewm@62 | 61 |
andrewm@62 | 62 SCRIPT_PRERUN= |
andrewm@62 | 63 SCRIPT_POSTRUN= |
andrewm@62 | 64 if [ $RUN_IN_LOOP -ne 0 ] ; then |
andrewm@62 | 65 SCRIPT_PRERUN="bash -c \\\"while true ; do" |
andrewm@62 | 66 SCRIPT_POSTRUN=" ; done \\\" " |
andrewm@62 | 67 fi |
andrewm@59 | 68 |
andrewm@59 | 69 ssh $BBB_ADDRESS "echo \"#!/bin/sh |
andrewm@59 | 70 # |
andrewm@59 | 71 # This file is autogenerated by BeagleRT. Do not edit! |
andrewm@59 | 72 |
andrewm@59 | 73 echo Running BeagleRT... |
andrewm@62 | 74 screen -S BeagleRT -d -m $SCRIPT_PRERUN $BBB_PATH/BeagleRT $COMMAND_ARGS $SCRIPT_POSTRUN\" > $BBB_STARTUP_SCRIPT" |
andrewm@59 | 75 |
andrewm@59 | 76 fi |