Mercurial > hg > beaglert
comparison scripts/update_board @ 452:7b63e3295343 prerelease
update_board : no-frills option, no-documentation option
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sun, 19 Jun 2016 21:27:37 +0100 |
parents | 86591d203c78 |
children | 4cccb13bf406 |
comparison
equal
deleted
inserted
replaced
448:fdb30affab1c | 452:7b63e3295343 |
---|---|
17 SCREEN_NAME=Bela | 17 SCREEN_NAME=Bela |
18 | 18 |
19 usage () | 19 usage () |
20 { | 20 { |
21 THIS_SCRIPT=`basename "$0"` | 21 THIS_SCRIPT=`basename "$0"` |
22 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [--clean] [-y]" | 22 echo "Usage: $THIS_SCRIPT [--clean] [--no-frills] [-dy ] [-i user@ip] [-b /path/to/remote/Bela]" |
23 | 23 |
24 echo " | 24 echo " |
25 This script updates the core Bela files on the BeagleBone, bringing it up | 25 This script updates the core Bela files on the BeagleBone, bringing it up |
26 to date with the files in the folder on the host computer. | 26 to date with the files in the folder on the host computer. |
27 The script must be run once to initialize the board before running any of | 27 The script must be run once to initialize the board before running any of |
32 | 32 |
33 Command line options: | 33 Command line options: |
34 -i arg : allows to set the username and IP address of the remote end (default: $BBB_ADDRESS) | 34 -i arg : allows to set the username and IP address of the remote end (default: $BBB_ADDRESS) |
35 -b arg : allows to set the path to the Bela folder on the remote end. Use quotes if you use the \"~\" symbol (default: $BBB_BELA_HOME) | 35 -b arg : allows to set the path to the Bela folder on the remote end. Use quotes if you use the \"~\" symbol (default: $BBB_BELA_HOME) |
36 --clean : removes all the files in the $BBB_BELA_HOME folder, INCLUDING any source code you may have in the $BBB_BELA_HOME/projects/ subdirectory. | 36 --clean : removes all the files in the $BBB_BELA_HOME folder, INCLUDING any source code you may have in the $BBB_BELA_HOME/projects/ subdirectory. |
37 -d : skips re-generating Doxygen documentation on the board. | |
38 --no-frills : skips some optional commands. | |
37 -y : does not prompt the user before deleting the remote files. | 39 -y : does not prompt the user before deleting the remote files. |
38 " | 40 " |
39 } | 41 } |
40 | 42 |
41 signal_handler () | 43 signal_handler () |
48 | 50 |
49 error_handler () { | 51 error_handler () { |
50 [ $1 -eq 0 ] && printf "done\n" || { [ -z "$2" ] && printf "\nAn error occurred. Is the board connected?\n" || printf "$2"; exit 1; } | 52 [ $1 -eq 0 ] && printf "done\n" || { [ -z "$2" ] && printf "\nAn error occurred. Is the board connected?\n" || printf "$2"; exit 1; } |
51 } | 53 } |
52 | 54 |
55 FULL=1 | |
53 OPTIND=1 | 56 OPTIND=1 |
54 ALWAYS_YES=0 | 57 ALWAYS_YES=0 |
55 RESET_BOARD=0 | 58 RESET_BOARD=0 |
59 DOXYGEN=1 | |
56 while [ "$1" != "" ]; do | 60 while [ "$1" != "" ]; do |
57 case $1 in | 61 case $1 in |
58 -b) | 62 -b) |
59 shift | 63 shift |
60 BBB_BELA_HOME=$1 | 64 BBB_BELA_HOME=$1 |
63 shift | 67 shift |
64 BBB_ADDRESS=$1 | 68 BBB_ADDRESS=$1 |
65 ;; | 69 ;; |
66 --clean) | 70 --clean) |
67 RESET_BOARD=1 | 71 RESET_BOARD=1 |
72 ;; | |
73 -d) | |
74 DOXYGEN=0 | |
75 ;; | |
76 --no-frills) | |
77 FULL=0 | |
68 ;; | 78 ;; |
69 -y) | 79 -y) |
70 ALWAYS_YES=1 | 80 ALWAYS_YES=1 |
71 ;; | 81 ;; |
72 *) | 82 *) |
80 | 90 |
81 # Find location of this script so we can locate the rest of the files | 91 # Find location of this script so we can locate the rest of the files |
82 SCRIPTDIR=$(dirname "$0") | 92 SCRIPTDIR=$(dirname "$0") |
83 [ -z "$IDE_FOLDER" ] && IDE_FOLDER=$SCRIPTDIR/../../bela-ide/ | 93 [ -z "$IDE_FOLDER" ] && IDE_FOLDER=$SCRIPTDIR/../../bela-ide/ |
84 | 94 |
85 set_date "stat $BBB_BELA_HOME &>/dev/null" && DESTINATION_EMPTY=0 || DESTINATION_EMPTY=1 | 95 # Set the date on the board |
96 [ $FULL -eq 1 ] && set_date | |
97 # Check if destination folder exists | |
98 ssh $BBB_ADDRESS stat $BBB_BELA_HOME &>/dev/null && DESTINATION_EMPTY=0 || DESTINATION_EMPTY=1 | |
86 | 99 |
87 if [ $DESTINATION_EMPTY -eq 0 ]; | 100 if [ $DESTINATION_EMPTY -eq 0 ]; |
88 then | 101 then |
89 echo "Updating the Bela core code in $BBB_ADDRESS:$BBB_BELA_HOME" | 102 echo "Updating the Bela core code in $BBB_ADDRESS:$BBB_BELA_HOME" |
90 if [ $RESET_BOARD -eq 1 ]; | 103 if [ $RESET_BOARD -eq 1 ]; |
102 fi | 115 fi |
103 else | 116 else |
104 echo "Installing Bela core code in $BBB_ADDRESS:$BBB_BELA_HOME" | 117 echo "Installing Bela core code in $BBB_ADDRESS:$BBB_BELA_HOME" |
105 fi | 118 fi |
106 | 119 |
107 echo "Updating Bela cores files to remote folder $BBB_BELA_HOME" | 120 echo "Updating Bela core files to remote folder $BBB_BELA_HOME" |
108 # Stop Bela if running and remove all files | 121 # Stop Bela if running and remove all files |
109 printf "Stopping Bela..." | 122 printf "Stopping Bela..." |
110 ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME idestop stop &>/dev/null; screen -X -S Bela quit &>/dev/null; screen -X -S IDE-Bela quit &>/dev/null; true"; | 123 ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME idestop stop &>/dev/null; screen -X -S Bela quit &>/dev/null; screen -X -S IDE-Bela quit &>/dev/null; true"; |
111 error_handler $? | 124 error_handler $? |
112 | 125 |
144 # Create remaining directories needed for building | 157 # Create remaining directories needed for building |
145 printf "Creating directory structure on BeagleBone..." | 158 printf "Creating directory structure on BeagleBone..." |
146 ssh $BBB_ADDRESS "mkdir -p $BBB_BELA_HOME/build/core $BBB_BELA_HOME/projects" | 159 ssh $BBB_ADDRESS "mkdir -p $BBB_BELA_HOME/build/core $BBB_BELA_HOME/projects" |
147 error_handler $? | 160 error_handler $? |
148 | 161 |
149 printf "Generating on-board documentation..." | 162 if [ $DOXYGEN -eq 1 ] |
150 #ssh $BBB_ADDRESS "cd $BBB_BELA_HOME; doxygen &> /dev/null" | 163 then |
151 error_handler $? "\nError while generating Doxygen documentation\n" | 164 printf "Generating on-board documentation..." |
165 ssh $BBB_ADDRESS "cd $BBB_BELA_HOME; doxygen &> /dev/null" | |
166 error_handler $? "\nError while generating Doxygen documentation\n" | |
167 fi | |
152 | 168 |
153 #------------- | 169 #------------- |
154 #Installing IDE | 170 #Installing IDE |
155 [ $ALWAYS_YES -eq 0 ] && ALWAYS_YES_FLAG= || ALWAYS_YES_FLAG="-y" | 171 [ $ALWAYS_YES -eq 0 ] && ALWAYS_YES_FLAG= || ALWAYS_YES_FLAG="-y" |
156 ls $IDE_FOLDER/scripts/setup_IDE.sh >/dev/null 2>/dev/null | 172 ls $IDE_FOLDER/scripts/setup_IDE.sh >/dev/null 2>/dev/null |
157 if [ $? -eq 0 ] | 173 if [ $? -eq 0 ] |
158 then | 174 then |
159 cd $IDE_FOLDER/scripts && ./setup_IDE.sh $ALWAYS_YES_FLAG | 175 cd $IDE_FOLDER/scripts && ./setup_IDE.sh $ALWAYS_YES_FLAG |
160 # run the IDE | 176 # run the IDE |
161 ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart" | 177 [ $FULL -eq 1 ] && ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart" |
162 else | 178 else |
163 # run the IDE | 179 # run the IDE |
164 ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart" | 180 [ $FULL -eq 1 ] && ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart" |
165 echo \ | 181 [ $FULL -eq 1 ] && echo "The Bela core files were updated the board, but a valid IDE folder was not found in $IDE_FOLDER/, so the IDE was not updated. If there was an older version of the IDE on the board, it is being restarted. |
166 "The Bela core files were updated the board, but a valid IDE folder was not found in $IDE_FOLDER/, so the IDE was not updated. If there was an older version of the IDE on the board, it is being restarted. | |
167 You can get a copy of the most up-to-date IDE files from https://github.com/LBDonovan/bela-ide | 182 You can get a copy of the most up-to-date IDE files from https://github.com/LBDonovan/bela-ide |
168 " | 183 " |
169 fi | 184 fi |
170 | 185 |
171 ssh $BBB_ADDRESS make -C $BBB_BELA_HOME --no-print-directory idestartup nostartup && echo "The board will now run the IDE at startup, but startup of the Bela program has been disabled. To enable it, use the set_startup.sh script" | 186 ssh $BBB_ADDRESS make -C $BBB_BELA_HOME --no-print-directory idestartup nostartup && echo "The board will now run the IDE at startup, but startup of the Bela program has been disabled. To enable it, use the set_startup.sh script" |
172 | 187 |
173 { [ $ALWAYS_YES -eq 1 ] || [ $SHLVL -ge 1 ]; } && printf "\nSetup complete.\n\n" || { | 188 [ $ALWAYS_YES -eq 1 ] && printf "\nSetup complete.\n\n" || { |
174 printf '\nSetup complete, press any key to continue\n\n' | 189 printf '\nSetup complete, press any key to continue\n\n' |
175 read | 190 read |
176 } | 191 } |