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