comparison scripts/update_board @ 454:1d66b4e8ced9 prerelease

--no-frills for udpate_board
author Giulio Moro <giuliomoro@yahoo.it>
date Sun, 19 Jun 2016 23:20:34 +0100
parents 4cccb13bf406
children 0567af952cfa
comparison
equal deleted inserted replaced
453:4cccb13bf406 454:1d66b4e8ced9
90 90
91 # 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
92 SCRIPTDIR=$(dirname "$0") 92 SCRIPTDIR=$(dirname "$0")
93 [ -z "$IDE_FOLDER" ] && IDE_FOLDER=$SCRIPTDIR/../../bela-ide/ 93 [ -z "$IDE_FOLDER" ] && IDE_FOLDER=$SCRIPTDIR/../../bela-ide/
94 94
95 # Check if destination folder exists
96 # the StrictHostKeyChecking no should prevent the unkown host prompt
97 ssh -o "StrictHostKeyChecking no" $BBB_ADDRESS stat $BBB_BELA_HOME &>/dev/null && DESTINATION_EMPTY=0 || DESTINATION_EMPTY=1
95 # Set the date on the board 98 # Set the date on the board
96 [ $FULL -eq 1 ] && set_date 99 [ $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
99 100
100 if [ $DESTINATION_EMPTY -eq 0 ]; 101 if [ $DESTINATION_EMPTY -eq 0 ];
101 then 102 then
102 echo "Updating the Bela core code in $BBB_ADDRESS:$BBB_BELA_HOME" 103 echo "Updating the Bela core code in $BBB_ADDRESS:$BBB_BELA_HOME"
103 if [ $RESET_BOARD -eq 1 ]; 104 if [ $RESET_BOARD -eq 1 ];
117 echo "Installing Bela core code in $BBB_ADDRESS:$BBB_BELA_HOME" 118 echo "Installing Bela core code in $BBB_ADDRESS:$BBB_BELA_HOME"
118 fi 119 fi
119 120
120 echo "Updating Bela core files to remote folder $BBB_BELA_HOME" 121 echo "Updating Bela core files to remote folder $BBB_BELA_HOME"
121 # Stop Bela if running and remove all files 122 # Stop Bela if running and remove all files
122 printf "Stopping Bela..." 123 if [ $FULL -eq 1 ]
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"; 124 then
124 error_handler $? 125 printf "Stopping Bela..."
126 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";
127 error_handler $?
128 fi
125 129
126 if [ $RESET_BOARD -eq 1 ]; 130 if [ $RESET_BOARD -eq 1 ];
127 then 131 then
128 printf "Removing old files..." 132 printf "Removing old files..."
129 ssh $BBB_ADDRESS "rm -rf $BBB_BELA_HOME"; 133 ssh $BBB_ADDRESS "rm -rf $BBB_BELA_HOME";
170 #Installing IDE 174 #Installing IDE
171 [ $ALWAYS_YES -eq 0 ] && ALWAYS_YES_FLAG= || ALWAYS_YES_FLAG="-y" 175 [ $ALWAYS_YES -eq 0 ] && ALWAYS_YES_FLAG= || ALWAYS_YES_FLAG="-y"
172 ls $IDE_FOLDER/scripts/setup_IDE.sh >/dev/null 2>/dev/null 176 ls $IDE_FOLDER/scripts/setup_IDE.sh >/dev/null 2>/dev/null
173 if [ $? -eq 0 ] 177 if [ $? -eq 0 ]
174 then 178 then
179 export BBB_ADDRESS BBB_BELA_HOME
175 cd $IDE_FOLDER/scripts && ./setup_IDE.sh $ALWAYS_YES_FLAG 180 cd $IDE_FOLDER/scripts && ./setup_IDE.sh $ALWAYS_YES_FLAG
176 # run the IDE 181 # run the IDE
177 [ $FULL -eq 1 ] && ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart" 182 [ $FULL -eq 1 ] && ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart"
178 else 183 else
179 # run the IDE 184 # run the IDE
181 [ $FULL -eq 1 ] && echo "The Bela core files were updated on 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. 186 [ $FULL -eq 1 ] && echo "The Bela core files were updated on 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.
182 You can get a copy of the most up-to-date IDE files from https://github.com/LBDonovan/bela-ide 187 You can get a copy of the most up-to-date IDE files from https://github.com/LBDonovan/bela-ide
183 " 188 "
184 fi 189 fi
185 190
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" 191 [ $FULL -eq 1 ] && 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"
187 192
188 [ $ALWAYS_YES -eq 1 ] && printf "\nSetup complete.\n\n" || { 193 [ $ALWAYS_YES -eq 1 ] && printf "\nSetup complete.\n\n" || {
189 printf '\nSetup complete, press any key to continue\n\n' 194 printf '\nSetup complete, press any key to continue\n\n'
190 read 195 read
191 } 196 }