1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Merge branch 'master' of git.opennebula.org:one

This commit is contained in:
Daniel Molina 2011-11-25 17:01:01 +01:00
commit e3d1ce2cd3
2 changed files with 25 additions and 6 deletions

View File

@ -35,9 +35,14 @@ DST_HOST=`arg_host $DST`
DST_DIR=`dirname $DST_PATH`
log "Moving $SRC_PATH"
exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR" \
"Unable to create directory $DST_DIR"
exec_and_log "$SCP -r $SRC $DST" \
"Could not copy $SRC to $DST"
exec_and_log "$SSH $SRC_HOST rm -rf $SRC_PATH"
if full_src_and_dst_equal; then
log "Not moving $SRC to $DST, they are the same path"
else
log "Moving $SRC_PATH"
exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR" \
"Unable to create directory $DST_DIR"
exec_and_log "$SCP -r $SRC $DST" \
"Could not copy $SRC to $DST"
exec_and_log "$SSH $SRC_HOST rm -rf $SRC_PATH"
fi

View File

@ -49,6 +49,20 @@ function fix_dir_slashes
dirname "$1/file" | $SED 's/\/+/\//g'
}
function get_compare_target
{
echo "$1" | $SED 's/\/+/\//g' | $SED 's/\\/images$//'
}
function full_src_and_dst_equal
{
s=`get_compare_target "$SRC"`
d=`get_compare_target "$DST"`
[ "$s" == "$d" ]
}
function fix_var_slashes
{
ONE_LOCAL_VAR=`fix_dir_slashes "$ONE_LOCAL_VAR"`