Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

send blockdiff_dump command to remote

  • Loading branch information...
commit 05535e846d88e1ed38827f173c4b349eba73a4e0 1 parent ebc6d7a
@kazuho authored
Showing with 16 additions and 4 deletions.
  1. +16 −4 ssh_blockdiff_dump
View
20 ssh_blockdiff_dump
@@ -20,9 +20,6 @@ fi
if [ ! "$TMPDIR" ] ; then
TMPDIR="/tmp"
fi
-if [ ! "$DUMP_CMD" ] ;then
- DUMP_CMD="blockdiff_dump"
-fi
EXIT_CODE=0
# obtain remote TMPDIR
@@ -33,6 +30,21 @@ if [ ! "$REMOTE_TMPDIR" ] ; then
REMOTE_TMPDIR="/tmp"
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
if [ -e "/dev/fd/5" ] ; then
CMD="cat > $REMOTE_TMPDIR/in_md5.$$"
@@ -66,7 +78,7 @@ if [ "$EXIT_CODE" -eq 0 ] ; then
fi
# 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
ssh $SSH_ARGS "rm -f $REMOTE_TMPDIR/in_md5.$$"
fi
Please sign in to comment.
Something went wrong with that request. Please try again.