Skip to content

Commit

Permalink
send blockdiff_dump command to remote
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuho committed Nov 25, 2009
1 parent ebc6d7a commit 05535e8
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions ssh_blockdiff_dump
Expand Up @@ -20,9 +20,6 @@ fi
if [ ! "$TMPDIR" ] ; then if [ ! "$TMPDIR" ] ; then
TMPDIR="/tmp" TMPDIR="/tmp"
fi fi
if [ ! "$DUMP_CMD" ] ;then
DUMP_CMD="blockdiff_dump"
fi
EXIT_CODE=0 EXIT_CODE=0


# obtain remote TMPDIR # obtain remote TMPDIR
Expand All @@ -33,6 +30,21 @@ if [ ! "$REMOTE_TMPDIR" ] ; then
REMOTE_TMPDIR="/tmp" REMOTE_TMPDIR="/tmp"
fi fi


# copy blockdiff_dump to remote
DUMP_CMD=`dirname "$0"`
if [ "$0" = `basename "$0"` ] ; then
DUMP_CMD=`which blockdiff_dump`
else
DUMP_CMD=`dirname "$0"`"/blockdiff_dump"
fi
if [ ! -x "$DUMP_CMD" ] ; then
echo "could not find blockdiff_dump" >&2
exit 1
fi
ssh $SSH_ARGS "cat > \"$REMOTE_TMPDIR/blockdiff_dump.$$\"" < "$DUMP_CMD" || exit $?
ssh $SSH_ARGS "chmod u+x \"$REMOTE_TMPDIR/blockdiff_dump.$$\"" || exit $?
DUMP_CMD="$REMOTE_TMPDIR/blockdiff_dump.$$"

# copy digest file to remote # copy digest file to remote
if [ -e "/dev/fd/5" ] ; then if [ -e "/dev/fd/5" ] ; then
CMD="cat > $REMOTE_TMPDIR/in_md5.$$" CMD="cat > $REMOTE_TMPDIR/in_md5.$$"
Expand Down Expand Up @@ -66,7 +78,7 @@ if [ "$EXIT_CODE" -eq 0 ] ; then
fi fi


# remove temporary files # remove temporary files
ssh $SSH_ARGS "rm -f $REMOTE_TMPDIR/out_md5.$$" ssh $SSH_ARGS "rm -f $REMOTE_TMPDIR/out_md5.$$ $REMOTE_TMPDIR/blockdiff_dump.$$"
if [ -e "/dev/fd/5" ] ; then if [ -e "/dev/fd/5" ] ; then
ssh $SSH_ARGS "rm -f $REMOTE_TMPDIR/in_md5.$$" ssh $SSH_ARGS "rm -f $REMOTE_TMPDIR/in_md5.$$"
fi fi
Expand Down

0 comments on commit 05535e8

Please sign in to comment.