changeset 425:99de323c13b3 prerelease

Scripts use sh instead of bash. Some fixes in run_project and build_project
author Giulio Moro <giuliomoro@yahoo.it>
date Thu, 16 Jun 2016 15:55:03 +0100
parents 9614e2f4b76e
children 4c2588930b0a
files scripts/build_pd_heavy.sh scripts/build_project.sh scripts/connect_to_project.sh scripts/halt_board.sh scripts/run_pd_libpd.sh scripts/run_project.sh scripts/set_startup.sh scripts/setup_ssh.sh scripts/stop_running.sh scripts/update_board.sh
diffstat 10 files changed, 39 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/build_pd_heavy.sh	Thu Jun 16 14:34:18 2016 +0100
+++ b/scripts/build_pd_heavy.sh	Thu Jun 16 15:55:03 2016 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 # shell script for automatic uploading/compiling of pd patch onto bbb
 # Christian Heinrichs 2015
--- a/scripts/build_project.sh	Thu Jun 16 14:34:18 2016 +0100
+++ b/scripts/build_project.sh	Thu Jun 16 15:55:03 2016 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # This script compiles a Bela project on the BeagleBone Black and
 # optionally runs it. Pass a directory path in the first argument. 
@@ -30,14 +30,16 @@
     The -c option passes command-line arguments to
     the Bela program; enclose the argument string in quotes.
 	
+    -p arg : sets the name of the project to run (default: $BBB_PROJECT_NAME ) 
+
     By default, the project runs in the foreground of the current terminal,
     within a screen session that can be detached later. The -f argument runs
     the project in the foreground of the current terminal, without screen, so
     the output can be piped to another destination. The -b argument runs it
     in a screen in the background, so no output is shown. The -m argument allows
     to pass arguments to the Makefile before the run target. For instance,
-    pass -m \`"projectclean"\` or \`-m "distclean"\` to clean project-specific pre-built
-    objects, or all the pre-built objects, respectively."
+    pass -m \`"projectclean"\` or \`-m "distclean"\` to clean project-specific
+    pre-built objects, or all the pre-built objects, respectively."
 }
 
 OPTIND=1
--- a/scripts/connect_to_project.sh	Thu Jun 16 14:34:18 2016 +0100
+++ b/scripts/connect_to_project.sh	Thu Jun 16 15:55:03 2016 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # This script brings an already running Bela program to the foreground 
 # in the terminal, so it can be run interactively.
--- a/scripts/halt_board.sh	Thu Jun 16 14:34:18 2016 +0100
+++ b/scripts/halt_board.sh	Thu Jun 16 15:55:03 2016 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # This script halts the BeagleBone Black.
 
--- a/scripts/run_pd_libpd.sh	Thu Jun 16 14:34:18 2016 +0100
+++ b/scripts/run_pd_libpd.sh	Thu Jun 16 15:55:03 2016 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # This script compiles a Bela project on the BeagleBone Black and
 # optionally runs it. Pass a directory path in the first argument. 
--- a/scripts/run_project.sh	Thu Jun 16 14:34:18 2016 +0100
+++ b/scripts/run_project.sh	Thu Jun 16 15:55:03 2016 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # This script runs an already-compiled Bela project on the
 # BeagleBone Black.
@@ -20,28 +20,35 @@
 
     echo "
     This script runs a previously compiled Bela project on the 
-    BeagleBone Black. The -b option changes the default path, which
-    is otherwise $BBB_BELA_HOME. The -c option passes command-line arguments
+    BeagleBone Black. The -c option passes command-line arguments
     to the Bela program; enclose the argument string in quotes.
+
+    -p arg : sets the name of the project to run (default: $BBB_PROJECT_NAME ) 
 	
-    The -f argument runs the project in the foreground of the current terminal,
-    within a screen session that can be detached later. The -F argument runs
-	the project in the foreground of the current terminal, without screen, so
-	the output can be piped to another destination."
+    By default, the project runs in the foreground of the current terminal,
+    within a screen session that can be detached later. The -f argument runs
+    the project in the foreground of the current terminal, without screen, so
+    the output can be piped to another destination. The -b argument runs it
+    in a screen in the background, so no output is shown. The -m argument allows
+    to pass arguments to the Makefile before the run target. For instance,
+    pass -m \`"projectclean"\` or \`-m "distclean"\` to clean project-specific
+    pre-built objects, or all the pre-built objects, respectively."
 }
 
 OPTIND=1
 
-while getopts "b:c:fFh" opt; do
+while getopts "bc:m:nfFhp:" opt; do
     case $opt in
-        b)            BBB_BELA_HOME=$OPTARG
-                      ;;
         c)            COMMAND_ARGS=$OPTARG
                       ;;
-        f)            RUN_IN_FOREGROUND=1
+        b)            RUN_IN_FOREGROUND=0
                       ;;
-	F)            RUN_WITHOUT_SCREEN=1
-		              ;;
+        f)            RUN_WITHOUT_SCREEN=1
+                      ;;
+	p)            BBB_PROJECT_NAME=$OPTARG
+		      ;;	
+	m)            BBB_MAKEFILE_OPTIONS=$OPTARG
+	              ;;
         h|\?)         usage
                       exit 1
     esac
@@ -56,14 +63,14 @@
     BBB_PROJECT_NAME=$1
 fi
 
-MAKE_COMMAND="make stop -C $BBB_BELA_HOME PROJECT='$BBB_PROJECT_NAME' CL='$COMMAND_ARGS'"
+MAKE_COMMAND="make --no-print-directory stop -C $BBB_BELA_HOME PROJECT='$BBB_PROJECT_NAME' CL='$COMMAND_ARGS'"
 echo "Running $BBB_PROJECT_NAME..."
-if [ $RUN_WITHOUT_SCREEN -ne 0 ]
+if [ $RUN_WITHOUT_SCREEN -eq 1 ]
 then
-    ssh $BBB_ADDRESS "$MAKE_COMMAND run"
-elif [ $RUN_IN_FOREGROUND -eq 0 ]
+    ssh -t $BBB_ADDRESS "$MAKE_COMMAND run"
+elif [ $RUN_IN_FOREGROUND -eq 1 ]
 then
-    ssh $BBB_ADDRESS "$MAKE_COMMAND runscreenfg"
+    ssh -t $BBB_ADDRESS "$MAKE_COMMAND runscreenfg"
 else
     ssh $BBB_ADDRESS "$MAKE_COMMAND runscreen"
 fi
--- a/scripts/set_startup.sh	Thu Jun 16 14:34:18 2016 +0100
+++ b/scripts/set_startup.sh	Thu Jun 16 15:55:03 2016 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # This script enables or disables running Bela when the board starts
 # up.
--- a/scripts/setup_ssh.sh	Thu Jun 16 14:34:18 2016 +0100
+++ b/scripts/setup_ssh.sh	Thu Jun 16 15:55:03 2016 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 [ -z "$BBB_HOSTNAME" ] && BBB_HOSTNAME="192.168.7.2"
 [ -z "$BBB_USER" ] && BBB_USER="root"
 [ -z "$BBB_HOST" ] && BBB_HOST="bbb"
--- a/scripts/stop_running.sh	Thu Jun 16 14:34:18 2016 +0100
+++ b/scripts/stop_running.sh	Thu Jun 16 15:55:03 2016 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # This script stops the Bela program running on the BeagleBone.
 
@@ -16,4 +16,4 @@
 # these scripts; the second will catch any leftovers run other ways
 
 BELA_AUDIO_THREAD_NAME=beaglert-audio 
-ssh $BBB_ADDRESS make -C $BBB_BELA_HOME stop
+ssh $BBB_ADDRESS make --no-print-directory -C $BBB_BELA_HOME stop
--- a/scripts/update_board.sh	Thu Jun 16 14:34:18 2016 +0100
+++ b/scripts/update_board.sh	Thu Jun 16 15:55:03 2016 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # This script copies the core Bela files to the BeagleBone Black
 # in preparation for building projects. It will remove any existing