~ubuntu-branches/ubuntu/saucy/globus-gass-copy/saucy-proposed

« back to all changes in this revision

Viewing changes to globus-dir-copy

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2011-12-28 20:48:04 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20111228204804-ir2pp35bx5425f6u
Tags: 8.2-1
* Update to Globus Toolkit 5.2.0
* Drop patches globus-gass-copy-doxygen.patch, globus-gass-copy-mingw.patch
  and globus-gass-copy-pathmax.patch (fixed upstream)
* Make doc package architecture independent

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
 
3
 
# This is a simple wrapper around globus-url-copy to perform a directory copy
4
 
# using tar streamed via gridftp.
5
 
#
6
 
# See http://www.mcs.anl.gov/~bresnaha/Stretch/ for other interesting ways
7
 
# to use this feature with any application that pipes data.
8
 
#
9
 
# In order to work with this feature, a server needs to be configured to
10
 
# enable the popen driver and tar with the following configuration options:
11
 
# -fs-whitelist file,popen,ordering -popen-whitelist tar:/bin/tar
12
 
 
13
 
 
14
 
## path or alias for gnu tar
15
 
LOCAL_TAR=tar
16
 
SERVER_TAR=tar
17
 
 
18
 
## parse the source and dest args
19
 
if [ "X$1" = "X" -o "X$2" = "X" ]; then
20
 
  echo "Usage: globus-dir-copy [source URL or path] [destination URL or path]"
21
 
  exit 1
22
 
fi
23
 
 
24
 
SRC_URL=${1%/}
25
 
SRC_PATH=${SRC_URL#*://*/}
26
 
if [ "${SRC_PATH}" != "${SRC_URL}" ]; then SRC_PATH=/$SRC_PATH; fi
27
 
SRC_TARGET=${SRC_PATH##*/}
28
 
SRC_PATH=${SRC_PATH%/*}
29
 
if [ "${SRC_PATH}X" = "X" ]; then SRC_PATH=.; fi
30
 
 
31
 
DEST_URL=${2%/}
32
 
DEST_PATH=${DEST_URL#*://*/}
33
 
if [ "${DEST_PATH}" != "${DEST_URL}" ]; then DEST_PATH=/$DEST_PATH; fi
34
 
if [ "${DEST_PATH}X" = "X" ]; then DEST_PATH=.; fi
35
 
 
36
 
 
37
 
 
38
 
## find transfer mode: get, put, third paty, or local.
39
 
case "$SRC_URL" in
40
 
  gsiftp://*|ftp://*)
41
 
    case "$DEST_URL" in
42
 
      gsiftp://*|ftp://*)
43
 
        MODE=tp
44
 
        ;;
45
 
      *)
46
 
        MODE=get
47
 
        ;;
48
 
    esac
49
 
    ;;
50
 
  *)
51
 
    case "$DEST_URL" in
52
 
      gsiftp://*|ftp://*)
53
 
        MODE=put
54
 
        ;;
55
 
      *)
56
 
        MODE=local
57
 
        ;;
58
 
    esac
59
 
    ;;
60
 
esac
61
 
 
62
 
#
63
 
# The path in the url doesn't affect the transfer, but include the full path
64
 
# so directory creation (-cd) will remain functional, and add TARSTREAM so 
65
 
# server logs will reflect what is going on.
66
 
#
67
 
 
68
 
case "$MODE" in
69
 
#####################################################################
70
 
  get)
71
 
#####################################################################
72
 
test -d "$DEST_PATH" || mkdir -p "$DEST_PATH" 2>/dev/null
73
 
globus-url-copy ${3} ${4} ${5} -src-pipe "${SERVER_TAR} cf - -C ${SRC_PATH} ${SRC_TARGET}" ${SRC_URL}/TARSTREAM - | ${LOCAL_TAR} xf - -C ${DEST_PATH}
74
 
 
75
 
;;
76
 
#####################################################################
77
 
  put)
78
 
#####################################################################
79
 
 
80
 
${LOCAL_TAR} cf - -C ${SRC_PATH} ${SRC_TARGET} | globus-url-copy -cd ${3} ${4} ${5} -dst-pipe "${SERVER_TAR} xf - -C ${DEST_PATH}" - ${DEST_URL}/TARSTREAM
81
 
 
82
 
;;
83
 
#####################################################################
84
 
  tp)
85
 
#####################################################################
86
 
 
87
 
globus-url-copy -cd ${3} ${4} ${5} -src-pipe "${SERVER_TAR} cf - -C ${SRC_PATH} ${SRC_TARGET}" -dst-pipe "${SERVER_TAR} xf - -C ${DEST_PATH}" ${SRC_URL}/TARSTREAM ${DEST_URL}/TARSTREAM
88
 
 
89
 
;;
90
 
#####################################################################
91
 
  local)
92
 
#####################################################################
93
 
 
94
 
test -d "$DEST_PATH" || mkdir -p "$DEST_PATH" 2>/dev/null
95
 
${LOCAL_TAR} cf - -C ${SRC_PATH} ${SRC_TARGET} | ${LOCAL_TAR} xf - -C ${DEST_PATH}
96
 
 
97
 
;;
98
 
esac
99