diff scripts/set_startup.sh @ 60:ad6b2767beaf newapi

Command-line argument support for BeagleRT program in scripts, plus a simple script for halting the BBB
author andrewm
date Wed, 15 Jul 2015 18:53:10 +0100
parents 5bdf6efbd0ed
children a11e23f4e6af
line wrap: on
line diff
--- a/scripts/set_startup.sh	Wed Jul 15 17:50:09 2015 +0100
+++ b/scripts/set_startup.sh	Wed Jul 15 18:53:10 2015 +0100
@@ -6,6 +6,7 @@
 BBB_ADDRESS="root@192.168.7.2"
 BBB_PATH="/root/BeagleRT"
 ENABLE_STARTUP=1
+COMMAND_ARGS=
 
 # This path is hard-coded in the BeagleRT image at present.
 BBB_STARTUP_SCRIPT="/root/BeagleRT_startup.sh"
@@ -13,21 +14,24 @@
 function usage
 {
     THIS_SCRIPT=`basename "$0"`
-    echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-n]"
+    echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args] [-n]"
 
     echo "
     This script enables (by default) or disables running the BeagleRT
     project at startup. The -n option disables auto-startup, otherwise
     auto-startup is enabled. The -b option changes the default path, which
-    is otherwise $BBB_PATH."
+    is otherwise $BBB_PATH. The -c option passes command-line arguments to
+    the BeagleRT program; enclose the argument string in quotes."
 }
 
 OPTIND=1
 
-while getopts "b:nh" opt; do
+while getopts "b:c:nh" opt; do
     case $opt in
         b)            BBB_PATH=$OPTARG
                       ;;
+        c)            COMMAND_ARGS=$OPTARG
+                      ;;
         n)            ENABLE_STARTUP=0
                       ;;
         h|\?)         usage
@@ -55,6 +59,6 @@
 # This file is autogenerated by BeagleRT. Do not edit!
 
 echo Running BeagleRT...
-screen -S BeagleRT -d -m $BBB_PATH/BeagleRT\" > $BBB_STARTUP_SCRIPT"
+screen -S BeagleRT -d -m $BBB_PATH/BeagleRT $COMMAND_ARGS\" > $BBB_STARTUP_SCRIPT"
 
 fi
\ No newline at end of file