annotate scripts/set_startup.sh @ 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
children ad6b2767beaf
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@59 9
andrewm@59 10 # This path is hard-coded in the BeagleRT image at present.
andrewm@59 11 BBB_STARTUP_SCRIPT="/root/BeagleRT_startup.sh"
andrewm@59 12
andrewm@59 13 function usage
andrewm@59 14 {
andrewm@59 15 THIS_SCRIPT=`basename "$0"`
andrewm@59 16 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-n]"
andrewm@59 17
andrewm@59 18 echo "
andrewm@59 19 This script enables (by default) or disables running the BeagleRT
andrewm@59 20 project at startup. The -n option disables auto-startup, otherwise
andrewm@59 21 auto-startup is enabled. The -b option changes the default path, which
andrewm@59 22 is otherwise $BBB_PATH."
andrewm@59 23 }
andrewm@59 24
andrewm@59 25 OPTIND=1
andrewm@59 26
andrewm@59 27 while getopts "b:nh" opt; do
andrewm@59 28 case $opt in
andrewm@59 29 b) BBB_PATH=$OPTARG
andrewm@59 30 ;;
andrewm@59 31 n) ENABLE_STARTUP=0
andrewm@59 32 ;;
andrewm@59 33 h|\?) usage
andrewm@59 34 exit 1
andrewm@59 35 esac
andrewm@59 36 done
andrewm@59 37
andrewm@59 38 shift $((OPTIND-1))
andrewm@59 39
andrewm@59 40 if [ $ENABLE_STARTUP -eq 0 ]
andrewm@59 41 then
andrewm@59 42 echo "Disabling BeagleRT at startup..."
andrewm@59 43
andrewm@59 44 ssh $BBB_ADDRESS "echo \"#!/bin/sh
andrewm@59 45 #
andrewm@59 46 # This file is autogenerated by BeagleRT. Do not edit!
andrewm@59 47
andrewm@59 48 # Run on startup disabled -- nothing to do here\" > $BBB_STARTUP_SCRIPT"
andrewm@59 49
andrewm@59 50 else
andrewm@59 51 echo "Enabling 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 echo Running BeagleRT...
andrewm@59 58 screen -S BeagleRT -d -m $BBB_PATH/BeagleRT\" > $BBB_STARTUP_SCRIPT"
andrewm@59 59
andrewm@59 60 fi