comparison scripts/update_board.sh @ 428:b27676f871d7 prerelease

Some more sh compatiblity things: no &>, no 'function'
author Giulio Moro <giuliomoro@yahoo.it>
date Thu, 16 Jun 2016 19:20:22 +0100
parents fd948111f8ea
children 8533f7198644
comparison
equal deleted inserted replaced
427:fd948111f8ea 428:b27676f871d7
13 # It is a bit nasty, but here we need to handle the case that the board may be 13 # It is a bit nasty, but here we need to handle the case that the board may be
14 # in any arbitrarily (bad) condition and try to handle it the best we can 14 # in any arbitrarily (bad) condition and try to handle it the best we can
15 BELA_IDE_SCREEN_NAME=IDE-Bela 15 BELA_IDE_SCREEN_NAME=IDE-Bela
16 SCREEN_NAME=Bela 16 SCREEN_NAME=Bela
17 17
18 function usage 18 usage ()
19 { 19 {
20 THIS_SCRIPT=`basename "$0"` 20 THIS_SCRIPT=`basename "$0"`
21 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [--clean] [-y]" 21 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [--clean] [-y]"
22 22
23 echo " 23 echo "
34 -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) 34 -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 --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. 35 --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 -y : does not prompt the user before deleting the remote files. 36 -y : does not prompt the user before deleting the remote files.
37 " 37 "
38 } 38 }
39 trap "echo; exit" SIGINT SIGTERM
40 39
41 function error_handler { 40 signal_handler ()
41 {
42 echo
43 exit
44 }
45
46 trap signal_handler SIGINT SIGTERM
47
48 error_handler () {
42 [ $1 -eq 0 ] && printf "done\n" || { [ -z "$2" ] && printf "\nAn error occurred. Is the board connected?\n" || printf "$2"; exit 1; } 49 [ $1 -eq 0 ] && printf "done\n" || { [ -z "$2" ] && printf "\nAn error occurred. Is the board connected?\n" || printf "$2"; exit 1; }
43 } 50 }
44 51
45 OPTIND=1 52 OPTIND=1
46 ALWAYS_YES=0 53 ALWAYS_YES=0
138 printf "Creating directory structure on BeagleBone..." 145 printf "Creating directory structure on BeagleBone..."
139 ssh $BBB_ADDRESS "mkdir -p $BBB_BELA_HOME/build/core $BBB_BELA_HOME/projects" 146 ssh $BBB_ADDRESS "mkdir -p $BBB_BELA_HOME/build/core $BBB_BELA_HOME/projects"
140 error_handler $? 147 error_handler $?
141 148
142 printf "Generating on-board documentation..." 149 printf "Generating on-board documentation..."
143 ssh $BBB_ADDRESS "cd $BBB_BELA_HOME; doxygen &>/dev/null" 150 #ssh $BBB_ADDRESS "cd $BBB_BELA_HOME; doxygen &> /dev/null"
144 error_handler $? "\nError while generating Doxygen documentation\n" 151 error_handler $? "\nError while generating Doxygen documentation\n"
145 152
146 #------------- 153 #-------------
147 #Installing IDE 154 #Installing IDE
148 ls $IDE_FOLDER/scripts/setup_IDE.sh &> /dev/null 155 ls $IDE_FOLDER/scripts/setup_IDE.sh >/dev/null 2>/dev/null
149 if [ $? -eq 0 ] 156 if [ $? -eq 0 ]
150 then 157 then
151 cd $IDE_FOLDER/scripts && ./setup_IDE.sh -y 158 cd $IDE_FOLDER/scripts && ./setup_IDE.sh -
152 # run the IDE 159 # run the IDE
153 ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart" 160 ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart"
154 else 161 else
155 # run the IDE 162 # run the IDE
156 ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart" 163 ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart"
157 echo \ 164 echo \
158 "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. 165 "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.
159 You can get a copy of the most up-to-date IDE files from https://github.com/LBDonovan/bela-ide" 166 You can get a copy of the most up-to-date IDE files from https://github.com/LBDonovan/bela-ide
167 "
160 fi 168 fi
161 169
162 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" 170 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"
163 171
164 172