annotate tools/pibake.in @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
rev   line source
0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
1 #!/bin/bash
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
2
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
3 DIR='@DIR@'
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
4 HOST=zeta
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
5 TOKEN=$DIR/guest_rsa
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
6 TOKSRC=/users/mike/pi/guest_rsa
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
7 PROG=$1
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
8
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
9 # Check that we have the login token
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
10 if ! [ -r $TOKEN ]; then
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
11 if [ -r $TOKSRC ]; then
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
12 cp $TOKSRC $TOKEN
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
13 else
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
14 echo "pibake: Please get the correct guest_rsa file from Mike" >&2
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
15 exit 2
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
16 fi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
17 fi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
18
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
19 # Make sure the token is private
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
20 chmod og-rwx $TOKEN
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
21
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
22 # Make sure socket directory exists
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
23 mkdir -p ~/.ssh/sockets
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
24
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
25 dir="user/$USER"
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
26 lib=/home/guest/lib
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
27
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
28 # Form batch job and submit it to the Pi
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
29 ( echo mkdir -p $dir
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
30 echo cd $dir
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
31 echo 'cat >b.s <<\EOF'
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
32 cat $1
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
33 echo EOF
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
34 echo "(set -x; gcc -I $lib $lib/pas0.o b.s -o b.out && ./b.out)"
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
35 echo rm -f b.s b.out ) \
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
36 | ssh -F $DIR/sshconfig $HOST /bin/bash
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
37