changeset 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 fdb30affab1c
children 4cccb13bf406
files scripts/update_board
diffstat 1 files changed, 26 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/update_board	Sun Jun 19 18:55:06 2016 +0100
+++ b/scripts/update_board	Sun Jun 19 21:27:37 2016 +0100
@@ -19,7 +19,7 @@
 usage ()
 {
     THIS_SCRIPT=`basename "$0"`
-    echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [--clean] [-y]"
+    echo "Usage: $THIS_SCRIPT [--clean] [--no-frills] [-dy ] [-i user@ip] [-b /path/to/remote/Bela]"
 
     echo "
     This script updates the core Bela files on the BeagleBone, bringing it up
@@ -34,6 +34,8 @@
     -i arg : allows to set the username and IP address of the remote end (default: $BBB_ADDRESS)
     -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)
     --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.
+    -d : skips re-generating Doxygen documentation on the board.
+    --no-frills : skips some optional commands.
     -y : does not prompt the user before deleting the remote files.
     "
 }
@@ -50,9 +52,11 @@
  [ $1 -eq 0 ] && printf "done\n" || { [ -z "$2" ] && printf "\nAn error occurred. Is the board connected?\n" || printf "$2"; exit 1; }
 }
 
+FULL=1
 OPTIND=1
 ALWAYS_YES=0
 RESET_BOARD=0
+DOXYGEN=1
 while [ "$1" != "" ]; do
   case $1 in
     -b)           
@@ -66,6 +70,12 @@
     --clean)
       RESET_BOARD=1
     ;;
+    -d)
+      DOXYGEN=0
+    ;;
+    --no-frills)
+      FULL=0
+    ;;
     -y)          
        ALWAYS_YES=1
     ;;
@@ -82,7 +92,10 @@
 SCRIPTDIR=$(dirname "$0")
 [ -z "$IDE_FOLDER" ] && IDE_FOLDER=$SCRIPTDIR/../../bela-ide/
 
-set_date "stat $BBB_BELA_HOME &>/dev/null" && DESTINATION_EMPTY=0 || DESTINATION_EMPTY=1
+# Set the date on the board
+[ $FULL -eq 1 ] && set_date 
+# Check if destination folder exists
+ssh $BBB_ADDRESS stat $BBB_BELA_HOME &>/dev/null && DESTINATION_EMPTY=0 || DESTINATION_EMPTY=1
 
 if [ $DESTINATION_EMPTY -eq 0 ];
 then
@@ -104,7 +117,7 @@
   echo "Installing Bela core code in $BBB_ADDRESS:$BBB_BELA_HOME"
 fi
 
-echo "Updating Bela cores files to remote folder $BBB_BELA_HOME"
+echo "Updating Bela core files to remote folder $BBB_BELA_HOME"
 # Stop Bela if running and remove all files
 printf "Stopping Bela..." 
 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";
@@ -146,9 +159,12 @@
 ssh $BBB_ADDRESS "mkdir -p $BBB_BELA_HOME/build/core $BBB_BELA_HOME/projects"
 error_handler $?
 
-printf "Generating on-board documentation..."
-#ssh $BBB_ADDRESS "cd $BBB_BELA_HOME; doxygen &> /dev/null"
-error_handler $? "\nError while generating Doxygen documentation\n"
+if [ $DOXYGEN -eq 1 ] 
+then 
+  printf "Generating on-board documentation..."
+  ssh $BBB_ADDRESS "cd $BBB_BELA_HOME; doxygen &> /dev/null"
+  error_handler $? "\nError while generating Doxygen documentation\n"
+fi
 
 #-------------
 #Installing IDE
@@ -158,19 +174,18 @@
 then
   cd $IDE_FOLDER/scripts && ./setup_IDE.sh $ALWAYS_YES_FLAG
   # run the IDE 
-  ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart"
+  [ $FULL -eq 1 ] && ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart"
 else
   # run the IDE 
-  ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart"
-  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.
+  [ $FULL -eq 1 ] && ssh $BBB_ADDRESS "make -C $BBB_BELA_HOME --no-print-directory idestart"
+  [ $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.
 You can get a copy of the most up-to-date IDE files from https://github.com/LBDonovan/bela-ide
 "
 fi
 
 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" 
 
-{ [ $ALWAYS_YES -eq 1 ] || [ $SHLVL -ge 1 ]; } && printf "\nSetup complete.\n\n" || {
+[ $ALWAYS_YES -eq 1 ] && printf "\nSetup complete.\n\n" || {
   printf '\nSetup complete, press any key to continue\n\n'
   read 
 }