mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-31 01:47:11 +03:00
77681ccfc8
git-svn-id: http://svn.opennebula.org/one/trunk@294 3034c82b-c49b-4eb3-8279-a7acafdc01c0
41 lines
710 B
Bash
Executable File
41 lines
710 B
Bash
Executable File
#!/bin/bash
|
|
|
|
SRC=$1
|
|
DST=$2
|
|
|
|
if [ -z "${ONE_LOCATION}" ]; then
|
|
TMCOMMON=/usr/lib/one/mads/tm_common.sh
|
|
else
|
|
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
|
|
fi
|
|
|
|
. $TMCOMMON
|
|
|
|
SRC_PATH=`arg_path $SRC`
|
|
DST_PATH=`arg_path $DST`
|
|
DST_HOST=`arg_host $DST`
|
|
|
|
log "$1 $2"
|
|
log "DST: $DST_PATH"
|
|
|
|
DST_DIR=`dirname $DST_PATH`
|
|
|
|
log "Creating directory $DST_DIR"
|
|
exec_and_log "ssh $DST_HOST mkdir -p $DST_DIR"
|
|
exec_and_log "ssh $DST_HOST chmod a+w $DST_DIR"
|
|
|
|
case $SRC in
|
|
http://*)
|
|
log "Downloading $SRC"
|
|
exec_and_log "ssh $DST_HOST wget -O $DST_PATH $SRC"
|
|
;;
|
|
|
|
*)
|
|
log "Cloning $SRC_PATH"
|
|
exec_and_log "ssh $DST_HOST cp $SRC_PATH $DST_PATH"
|
|
;;
|
|
esac
|
|
|
|
exec_and_log "ssh $DST_HOST chmod a+w $DST_PATH"
|
|
|