changeset 462:d9a4fc5357e7 prerelease

Path-relativeness of scripts has been improved. At least update_board will work when double clicked
author Giulio Moro <giuliomoro@yahoo.it>
date Mon, 20 Jun 2016 14:09:43 +0100
parents 26b3b87437fb
children c47709e8b5c9
files scripts/build_pd_heavy.sh scripts/build_project.sh scripts/connect_to_project.sh scripts/halt_board.sh scripts/ide.sh scripts/run_pd_libpd.sh scripts/run_project.sh scripts/set_startup.sh scripts/setup_ssh.sh scripts/stop_running.sh
diffstat 10 files changed, 34 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/build_pd_heavy.sh	Mon Jun 20 13:49:48 2016 +0100
+++ b/scripts/build_pd_heavy.sh	Mon Jun 20 14:09:43 2016 +0100
@@ -21,7 +21,9 @@
 RUN_WITHOUT_SCREEN=1
 BELA_PYTHON27=
 
-. ./.bela_common || exit 1
+SCRIPTDIR=$(dirname "$0")
+[ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/ 
+. $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; }  
 
 if [ -z "$BELA_PYTHON27" ]; then
     for PY in python python2.7 ; do
@@ -116,8 +118,7 @@
 	done
 
         # invoke the online compiler
-        echo "$BELA_PYTHON27" hvresources/uploader.py "$pdpath"/ -n $ENZIENAUDIO_COM_PATCH_NAME -g c -o "$projectpath" $RELEASE_STRING
-        "$BELA_PYTHON27" hvresources/uploader.py "$pdpath"/ -n $ENZIENAUDIO_COM_PATCH_NAME -g c -o "$projectpath" $RELEASE_STRING ||\
+        "$BELA_PYTHON27" $SCRIPTDIR/hvresources/uploader.py "$pdpath"/ -n $ENZIENAUDIO_COM_PATCH_NAME -g c -o "$projectpath" $RELEASE_STRING ||\
             { echo "ERROR: an error occurred while executing the uploader.py script"; exit 1; }
     fi;
 
--- a/scripts/build_project.sh	Mon Jun 20 13:49:48 2016 +0100
+++ b/scripts/build_project.sh	Mon Jun 20 14:09:43 2016 +0100
@@ -6,7 +6,9 @@
 
 # set defaults unless variables are already set
 
-. ./.bela_common || exit 1
+SCRIPTDIR=$(dirname "$0")
+[ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/ 
+. $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; }  
 
 usage()
 {
--- a/scripts/connect_to_project.sh	Mon Jun 20 13:49:48 2016 +0100
+++ b/scripts/connect_to_project.sh	Mon Jun 20 14:09:43 2016 +0100
@@ -3,15 +3,8 @@
 # This script brings an already running Bela program to the foreground 
 # in the terminal, so it can be run interactively.
 
-[ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2"
-[ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/Bela/"
-[ -z "$BBB_SCREEN_NAME" ] && BBB_SCREEN_NAME="Bela"
-[ -z "$RUN_PROJECT" ] && RUN_PROJECT=1
-[ -z "$COMMAND_ARGS" ] && COMMAND_ARGS=
-[ -z "$RUN_IN_FOREGROUND" ] && RUN_IN_FOREGROUND=1
-[ -z "$RUN_WITHOUT_SCREEN" ] && RUN_WITHOUT_SCREEN=0
-[ -z "$BBB_PROJECT_HOME" ] && BBB_PROJECT_HOME="${BBB_BELA_HOME}/projects/"
-[ -z "$BBB_DEFAULT_PROJECT_NAME" ] && BBB_DEFAULT_PROJECT_NAME="scriptUploadedProject"
-[ -z "$BBB_PROJECT_NAME" ] && BBB_PROJECT_NAME=$BBB_DEFAULT_PROJECT_NAME
+SCRIPTDIR=$(dirname "$0")
+[ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/ 
+. $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; }  
 
 ssh -t $BBB_ADDRESS "make -C "$BBB_BELA_HOME" connect"
--- a/scripts/halt_board.sh	Mon Jun 20 13:49:48 2016 +0100
+++ b/scripts/halt_board.sh	Mon Jun 20 14:09:43 2016 +0100
@@ -2,7 +2,9 @@
 #
 # This script halts the BeagleBone Black.
 
-[ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2"
+SCRIPTDIR=$(dirname "$0")
+[ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/ 
+. $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; }  
 
 echo "Shutting down the BeagleBone Black..."
 ssh $BBB_ADDRESS "halt"
--- a/scripts/ide.sh	Mon Jun 20 13:49:48 2016 +0100
+++ b/scripts/ide.sh	Mon Jun 20 14:09:43 2016 +0100
@@ -3,7 +3,9 @@
 
 # set defaults unless variables are already set
 
-. ./.bela_common || exit 1
+SCRIPTDIR=$(dirname "$0")
+[ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/ 
+. $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; }  
 
 usage()
 {
--- a/scripts/run_pd_libpd.sh	Mon Jun 20 13:49:48 2016 +0100
+++ b/scripts/run_pd_libpd.sh	Mon Jun 20 14:09:43 2016 +0100
@@ -4,9 +4,10 @@
 # optionally runs it. Pass a directory path in the first argument. 
 # The source files in this directory are copied to the board and compiled.
 
-BBB_ADDRESS="root@192.168.7.2"
-BBB_LIBPD_EXECUTABLE_PATH="~/libpd/Bela"
-BBB_LIBPD_PROJECT_PATH="~/libpd/source/"
+SCRIPTDIR=$(dirname "$0")
+[ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/ 
+. $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; }  
+
 RUN_PROJECT=1
 COMMAND_ARGS=
 RUN_IN_FOREGROUND=0
--- a/scripts/run_project.sh	Mon Jun 20 13:49:48 2016 +0100
+++ b/scripts/run_project.sh	Mon Jun 20 14:09:43 2016 +0100
@@ -3,15 +3,9 @@
 # This script runs an already-compiled Bela project on the
 # BeagleBone Black.
 
-[ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2"
-[ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/Bela/"
-[ -z "$BBB_SCREEN_NAME" ] && BBB_SCREEN_NAME="Bela"
-[ -z "$RUN_PROJECT" ] && RUN_PROJECT=1
-[ -z "$COMMAND_ARGS" ] && COMMAND_ARGS=
-[ -z "$RUN_IN_FOREGROUND" ] && RUN_IN_FOREGROUND=1
-[ -z "$RUN_WITHOUT_SCREEN" ] && RUN_WITHOUT_SCREEN=0
-[ -z "$BBB_PROJECT_HOME" ] && BBB_PROJECT_HOME="${BBB_BELA_HOME}/projects/"
-[ -z "$BBB_DEFAULT_PROJECT_NAME" ] && BBB_DEFAULT_PROJECT_NAME="scriptUploadedProject"
+SCRIPTDIR=$(dirname "$0")
+[ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/ 
+. $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; }  
 
 usage()
 {
--- a/scripts/set_startup.sh	Mon Jun 20 13:49:48 2016 +0100
+++ b/scripts/set_startup.sh	Mon Jun 20 14:09:43 2016 +0100
@@ -3,16 +3,10 @@
 # This script enables or disables running Bela when the board starts
 # up.
 
-[ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2"
-[ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/Bela/"
-[ -z "$BBB_SCREEN_NAME" ] && BBB_SCREEN_NAME="Bela"
-[ -z "$RUN_PROJECT" ] && RUN_PROJECT=1
-[ -z "$COMMAND_ARGS" ] && COMMAND_ARGS=
-[ -z "$RUN_IN_FOREGROUND" ] && RUN_IN_FOREGROUND=1
-[ -z "$RUN_WITHOUT_SCREEN" ] && RUN_WITHOUT_SCREEN=0
-[ -z "$BBB_PROJECT_HOME" ] && BBB_PROJECT_HOME="${BBB_BELA_HOME}/projects/"
-[ -z "$BBB_DEFAULT_PROJECT_NAME" ] && BBB_DEFAULT_PROJECT_NAME="scriptUploadedProject"
-[ -z "$BBB_PROJECT_NAME" ] && BBB_PROJECT_NAME=$BBB_DEFAULT_PROJECT_NAME
+SCRIPTDIR=$(dirname "$0")
+[ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/ 
+. $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; }  
+
 ENABLE_STARTUP=1
 RUN_IN_LOOP=0
 
--- a/scripts/setup_ssh.sh	Mon Jun 20 13:49:48 2016 +0100
+++ b/scripts/setup_ssh.sh	Mon Jun 20 14:09:43 2016 +0100
@@ -1,7 +1,8 @@
 #!/bin/sh
-[ -z "$BBB_HOSTNAME" ] && BBB_HOSTNAME="192.168.7.2"
-[ -z "$BBB_USER" ] && BBB_USER="root"
-[ -z "$BBB_HOST" ] && BBB_HOST="bbb"
+SCRIPTDIR=$(dirname "$0")
+[ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/ 
+. $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; }  
+
 CONFIG_FILENAME=$HOME/.ssh/config
 mkdir -p $HOME/.ssh # create the ssh folder if it does not exist
 printf "\nHost $BBB_HOST\nHostname $BBB_HOSTNAME\nUser $BBB_USER\nStrictHostKeyChecking=no\n\n" >> $HOME/.ssh/config 
--- a/scripts/stop_running.sh	Mon Jun 20 13:49:48 2016 +0100
+++ b/scripts/stop_running.sh	Mon Jun 20 14:09:43 2016 +0100
@@ -2,18 +2,8 @@
 #
 # This script stops the Bela program running on the BeagleBone.
 
-[ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2"
-[ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/Bela/"
-[ -z "$BBB_SCREEN_NAME" ] && BBB_SCREEN_NAME="Bela"
-[ -z "$RUN_PROJECT" ] && RUN_PROJECT=1
-[ -z "$COMMAND_ARGS" ] && COMMAND_ARGS=
-[ -z "$RUN_IN_FOREGROUND" ] && RUN_IN_FOREGROUND=1
-[ -z "$RUN_WITHOUT_SCREEN" ] && RUN_WITHOUT_SCREEN=0
-[ -z "$BBB_PROJECT_HOME" ] && BBB_PROJECT_HOME="${BBB_BELA_HOME}/projects/"
-[ -z "$BBB_DEFAULT_PROJECT_NAME" ] && BBB_DEFAULT_PROJECT_NAME="scriptUploadedProject"
-[ -z "$BBB_PROJECT_NAME" ] && BBB_PROJECT_NAME=$BBB_DEFAULT_PROJECT_NAME
-# The first command should be sufficient to stop any Bela run with
-# these scripts; the second will catch any leftovers run other ways
+SCRIPTDIR=$(dirname "$0")
+[ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/ 
+. $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; }  
 
-BELA_AUDIO_THREAD_NAME=beaglert-audio 
 ssh $BBB_ADDRESS make --no-print-directory -C $BBB_BELA_HOME stop