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

bug #312: changes to fix_path in nfs tm commands

This commit is contained in:
Javi Fontan 2010-09-10 16:44:25 +02:00
parent 6bb52aeaec
commit 9af844e5b1

View File

@ -42,12 +42,26 @@ WGET=/usr/bin/wget
function get_vmdir
{
VMDIR=`grep '^VM_DIR=' $ONE_LOCAL_VAR/config | cut -d= -f2`
fix_var_slashes
}
function fix_dir_slashes
{
dirname "$1/file" | sed -E 's/\/+/\//g'
}
function fix_var_slashes
{
ONE_LOCAL_VAR=`fix_dir_slashes "$ONE_LOCAL_VAR"`
VMDIR=`fix_dir_slashes "$VMDIR"`
}
function fix_paths
{
if [ -n "$VMDIR" ]; then
SRC_PATH=`fix_dir_slashes "$SRC_PATH"`
SRC_PATH=${SRC_PATH/$VMDIR/$ONE_LOCAL_VAR}
DST_PATH=`fix_dir_slashes "$DST_PATH"`
DST_PATH=${DST_PATH/$VMDIR/$ONE_LOCAL_VAR}
fi
}
@ -55,6 +69,7 @@ function fix_paths
function fix_src_path
{
if [ -n "$VMDIR" ]; then
SRC_PATH=`fix_dir_slashes "$SRC_PATH"`
SRC_PATH=${SRC_PATH/$VMDIR/$ONE_LOCAL_VAR}
fi
}
@ -62,6 +77,7 @@ function fix_src_path
function fix_dst_path
{
if [ -n "$VMDIR" ]; then
DST_PATH=`fix_dir_slashes "$DST_PATH"`
DST_PATH=${DST_PATH/$VMDIR/$ONE_LOCAL_VAR}
fi
}