Created
February 5, 2017 08:57
-
-
Save balos1/74d552df324b830422d5a05a8a4af06c to your computer and use it in GitHub Desktop.
Remotely use modelsim.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#configuration | |
REMOTE_USER=john.doe | |
REMOTE_HOST=122.22.22.221 | |
REMOTE_HOME='/home/john.doe' | |
REMOTE_MODELSIM_DIR='/opt/altera/10.0/modelsim_ase/bin' | |
COMMAND=`basename $0` | |
# calculate the arguments, with proper quotes around each argument | |
for ARG in "$@" | |
do | |
ARGS="$ARGS \"$ARG\"" | |
done | |
# Calculate a directory on the remote build server, where we can put our data | |
HASH=$(echo ${PWD} ${HOSTNAME} ${USER} | shasum | cut -c1-32) | |
REMOTE_DIR=${REMOTE_HOME}/remote_compilation/${HASH} | |
# sync the project directory. You don't need this if you are using a network shared folder. | |
function try_rsync(){ | |
rsync -r ${PWD}/* ${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_DIR} | |
} | |
function createRemoteDir(){ | |
echo "rsync failed, probably because the remote directory $REMOTE_DIR did not exits. Retrying." >&2 | |
ssh ${REMOTE_USER}@${REMOTE_HOST} "mkdir -p ${REMOTE_DIR}" | |
} | |
try_rsync || ( createRemoteDir && try_rsync ) || exit -1 | |
# end sync | |
REMOTE_SCRIPT=\ | |
"cd ${REMOTE_DIR}; "\ | |
"MODELSIM_DIR=/opt/altera/10.0/modelsim_ase/bin ; "\ | |
"/opt/altera/10.0/modelsim_ase/bin/$COMMAND $ARGS" | |
# echo "# Running remote command $REMOTE_SCRIPT" | |
ssh ${REMOTE_USER}@${REMOTE_HOST} $REMOTE_SCRIPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment