Blame maint/fcrosscompile/cross_run
|
Packit |
0848f5 |
#!/bin/sh
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
# This script takes one argument, $pgm, and run it on $BACKEND.
|
|
Packit |
0848f5 |
BACKEND=mic0
|
|
Packit |
0848f5 |
pgm="$@"
|
|
Packit |
0848f5 |
SSH="ssh -q"
|
|
Packit |
0848f5 |
SCP="scp -q"
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
# Assume a common file system, e.g. NFS, exists between backend and frontend,
|
|
Packit |
0848f5 |
# a much FASTER and simpler way of launching the $pgm.
|
|
Packit |
0848f5 |
# so $PWD which is current working directory on the frontend exists on
|
|
Packit |
0848f5 |
# the backend as well. Execute $@ remotely on $PWD.
|
|
Packit |
0848f5 |
#
|
|
Packit |
0848f5 |
# $SSH $BACKEND "cd $PWD && $pgm"
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
# Assume NO common file system: A SLOW and complicated of running test.
|
|
Packit |
0848f5 |
# Create a random directory name locally.
|
|
Packit |
0848f5 |
wdir="`mktemp --tmpdir=/tmp fcross.XXXXXX`"
|
|
Packit |
0848f5 |
# Create the same directory remotely.
|
|
Packit |
0848f5 |
$SSH $BACKEND "mkdir $wdir" 2> /dev/null && \
|
|
Packit |
0848f5 |
# Copy the $pgm to the remote directory.
|
|
Packit |
0848f5 |
$SCP -p $pgm ${BACKEND}:${wdir} && \
|
|
Packit |
0848f5 |
# Launch the $pgm from the remote diectory.
|
|
Packit |
0848f5 |
$SSH $BACKEND "cd $wdir && $pgm" 2> /dev/null && \
|
|
Packit |
0848f5 |
# Copy whatever remote files created due to $pgm back to local directory.
|
|
Packit |
0848f5 |
$SCP ${BACKEND}:${wdir}/* . && \
|
|
Packit |
0848f5 |
# Remove the remote directory.
|
|
Packit |
0848f5 |
$SSH $BACKEND "rm -rf $wdir" 2> /dev/null && \
|
|
Packit |
0848f5 |
# Remove the local random directory.
|
|
Packit |
0848f5 |
rm -rf $wdir
|