changeset 59:5bdf6efbd0ed newapi

Added a script for enabling/disabling BeagleRT at startup. Only works with the matching SD image that looks for /root/BeagleRT_startup.sh
author andrewm
date Wed, 15 Jul 2015 17:50:09 +0100
parents 3ffafa57302c
children ad6b2767beaf
files scripts/set_startup.sh
diffstat 1 files changed, 60 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/set_startup.sh	Wed Jul 15 17:50:09 2015 +0100
@@ -0,0 +1,60 @@
+#!/bin/bash
+#
+# This script enables or disables running BeagleRT when the board starts
+# up.
+
+BBB_ADDRESS="root@192.168.7.2"
+BBB_PATH="/root/BeagleRT"
+ENABLE_STARTUP=1
+
+# This path is hard-coded in the BeagleRT image at present.
+BBB_STARTUP_SCRIPT="/root/BeagleRT_startup.sh"
+
+function usage
+{
+    THIS_SCRIPT=`basename "$0"`
+    echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-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."
+}
+
+OPTIND=1
+
+while getopts "b:nh" opt; do
+    case $opt in
+        b)            BBB_PATH=$OPTARG
+                      ;;
+        n)            ENABLE_STARTUP=0
+                      ;;
+        h|\?)         usage
+                      exit 1
+    esac
+done
+
+shift $((OPTIND-1))
+
+if [ $ENABLE_STARTUP -eq 0 ]
+then
+    echo "Disabling BeagleRT at startup..."
+
+    ssh $BBB_ADDRESS "echo \"#!/bin/sh
+#
+# This file is autogenerated by BeagleRT. Do not edit!
+
+# Run on startup disabled -- nothing to do here\" > $BBB_STARTUP_SCRIPT"
+
+else
+    echo "Enabling BeagleRT at startup..."
+
+    ssh $BBB_ADDRESS "echo \"#!/bin/sh
+#
+# This file is autogenerated by BeagleRT. Do not edit!
+
+echo Running BeagleRT...
+screen -S BeagleRT -d -m $BBB_PATH/BeagleRT\" > $BBB_STARTUP_SCRIPT"
+
+fi
\ No newline at end of file