-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrunbp
executable file
·31 lines (28 loc) · 1.07 KB
/
runbp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/ksh
# Runs a command remotely on the Pi, assuming default credentials and device name.
# Copies a whole directory structure to the same location (relative to ~) on the Pi
#
# E.g.
# cd ExamplePrograms; ../runbp python SimpleApp.py
#
# This script lives in the base directory of the content to be copied.
# DON'T PUT IT IN YOUR HOME DIRECTORY!!
# It deletes the corresponding directory on the Pi before copying the new structure over.
#
# To make it executable:
# chmod a+x runpb
#
# To make ssh work without entering passwords, see
# https://www.debian.org/devel/passwordlessssh
#
# Note - The windows will appear on the BrickPi's screen, not locally to this machine.
# Current working directory relative to home:
WorkingRelDir=${PWD#$HOME/}
# BrickPython project directory relative to home:
BrickPythonDir=$(cd $(dirname $0);echo $PWD)
BrickPythonRelativeDir=${BrickPythonDir#$HOME/}
(
cd ~
tar cf - $BrickPythonRelativeDir | ssh pi@raspberrypi "(rm -rf $BrickPythonRelativeDir; tar xf -)"
)
ssh -t pi@raspberrypi "(export DISPLAY=:1.0; cd $WorkingRelDir; $*)"