Mercurial > hg > beaglert
comparison scripts/update_board @ 461:26b3b87437fb prerelease
update_board made path-independent (for what is possible ... )
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 20 Jun 2016 13:49:48 +0100 |
parents | aa3f38d8a9b6 |
children | 898d57ac58a5 |
comparison
equal
deleted
inserted
replaced
460:f96238bdbb18 | 461:26b3b87437fb |
---|---|
1 #!/bin/sh | 1 #!/bin/sh |
2 # | 2 # |
3 # This script copies the core Bela files to the BeagleBone Black | 3 # This script copies the core Bela files to the BeagleBone Black |
4 # in preparation for building projects. It will remove any existing | 4 # in preparation for building projects. It will remove any existing |
5 # Bela directory before copying the files over | 5 # Bela directory before copying the files over |
6 [ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2" | 6 |
7 [ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="/root/Bela/" | 7 # Find location of this script so we can locate the rest of the files |
8 | 8 SCRIPTDIR=$(dirname "$0") |
9 . ./.bela_common || exit 1 | 9 [ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/ |
10 . $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; } | |
11 | |
12 [ -z "$IDE_FOLDER" ] && IDE_FOLDER=$SCRIPTDIR/../../bela-ide/ | |
10 | 13 |
11 FILES_TO_COPY="core include Makefile libNE10.a libprussdrv.a examples Doxyfile" | 14 FILES_TO_COPY="core include Makefile libNE10.a libprussdrv.a examples Doxyfile" |
12 | 15 |
13 # The following variables are manually copied from the Makefile. | 16 # The following variables are manually copied from the Makefile. |
14 # It is a bit nasty, but here we need to handle the case that the board may be | 17 # It is a bit nasty, but here we need to handle the case that the board may be |
86 esac | 89 esac |
87 shift | 90 shift |
88 done | 91 done |
89 | 92 |
90 | 93 |
91 # Find location of this script so we can locate the rest of the files | |
92 SCRIPTDIR=$(dirname "$0") | |
93 [ -z "$IDE_FOLDER" ] && IDE_FOLDER=$SCRIPTDIR/../../bela-ide/ | |
94 | 94 |
95 # Check if destination folder exists | 95 # Check if destination folder exists |
96 # the StrictHostKeyChecking no should prevent the unkown host prompt | 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 | 97 ssh -o "StrictHostKeyChecking no" $BBB_ADDRESS stat $BBB_BELA_HOME &>/dev/null && DESTINATION_EMPTY=0 || DESTINATION_EMPTY=1 |
98 # Set the date on the board | 98 # Set the date on the board |
144 printf "Updating files..." | 144 printf "Updating files..." |
145 # Copy relevant files to BeagleBone Black | 145 # Copy relevant files to BeagleBone Black |
146 if [ $RSYNC_AVAILABLE -eq 1 ]; | 146 if [ $RSYNC_AVAILABLE -eq 1 ]; |
147 then | 147 then |
148 [ -z `which sed` ] && FILTER=cat || FILTER="sed s/\\n// | sed s/^.*:/Updated\ files:\/g | tr \"\n\" \" \"" | 148 [ -z `which sed` ] && FILTER=cat || FILTER="sed s/\\n// | sed s/^.*:/Updated\ files:\/g | tr \"\n\" \" \"" |
149 rsync -ac --no-t --delete-after --stats $FILES_TO_COPY $BBB_ADDRESS:$BBB_BELA_HOME |grep -i "Number" | grep -i "files" | grep -i "transferred" | eval $FILTER &&\ | 149 rsync -ac --no-t --delete-after --stats $FILES_TO_COPY $BBB_ADDRESS:$BBB_BELA_HOME 2>/dev/null |grep -i "Number" | grep -i "files" | grep -i "transferred" | eval $FILTER &&\ |
150 rsync -ac --no-t libpd.so $BBB_ADDRESS:/usr/lib | 150 rsync -ac --no-t libpd.so $BBB_ADDRESS:/usr/lib |
151 else | 151 else |
152 # if rsync is not available, then clean the folders before copying the files | 152 # if rsync is not available, then clean the folders before copying the files |
153 ssh $BBB_ADDRESS "rm -rf $FILES_TO_COPY; mkdir -p $BBB_BELA_HOME" &&\ | 153 ssh $BBB_ADDRESS "rm -rf $FILES_TO_COPY; mkdir -p $BBB_BELA_HOME" &&\ |
154 scp -r -q $FILES_TO_COPY $BBB_ADDRESS:$BBB_BELA_HOME &&\ | 154 scp -r -q $FILES_TO_COPY $BBB_ADDRESS:$BBB_BELA_HOME &&\ |
188 cd $IDE_FOLDER/scripts && ./setup_IDE.sh $ALWAYS_YES_FLAG | 188 cd $IDE_FOLDER/scripts && ./setup_IDE.sh $ALWAYS_YES_FLAG |
189 # run the IDE | 189 # run the IDE |
190 [ $FULL -eq 1 ] && ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart" | 190 [ $FULL -eq 1 ] && ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart" |
191 else | 191 else |
192 # run the IDE | 192 # run the IDE |
193 [ $FULL -eq 1 ] && ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart" | 193 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. |
194 [ $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. | 194 You can get a copy of the most up-to-date IDE files from https://github.com/LBDonovan/bela-ide" |
195 You can get a copy of the most up-to-date IDE files from https://github.com/LBDonovan/bela-ide | 195 [ $FULL -eq 1 ] && ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart" &&\ |
196 " | 196 echo "If there was an older version of the IDE on the board, it is being restarted." |
197 fi | 197 fi |
198 | 198 |
199 [ $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" | 199 [ $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. To control the ide use the ide.sh script" |
200 | 200 |
201 [ $ALWAYS_YES -eq 1 ] && printf "\nSetup complete.\n\n" || { | 201 [ $ALWAYS_YES -eq 1 ] && printf "\nSetup complete.\n\n" || { |
202 printf '\nSetup complete, press any key to continue\n\n' | 202 printf '\nSetup complete, press any key to continue\n\n' |
203 read | 203 read |
204 } | 204 } |