mirror of
https://github.com/flynx/proxmox-utils.git
synced 2025-12-18 17:41:47 +00:00
reworked path handling...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
551da5ded3
commit
6fb0002145
12
.pct-helpers
12
.pct-helpers
@ -126,6 +126,18 @@ hostname2ct(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
normpath(){
|
||||||
|
echo $1 \
|
||||||
|
| sed \
|
||||||
|
-e 's/\/\+/\//g' \
|
||||||
|
-e 's/\/.\//\//g' \
|
||||||
|
-e 's/[^\/]\+\/\.\.//g' \
|
||||||
|
-e 's/\/\+/\//g' \
|
||||||
|
-e 's/\/\.$/\//g'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# vim:set ts=4 sw=4 nowrap :
|
# vim:set ts=4 sw=4 nowrap :
|
||||||
|
|||||||
@ -34,7 +34,7 @@ to=$3
|
|||||||
|
|
||||||
# get from path relative to working directory...
|
# get from path relative to working directory...
|
||||||
if [[ ${from:0:1} != '/' ]] ; then
|
if [[ ${from:0:1} != '/' ]] ; then
|
||||||
from="$(pwd)/${from}"
|
from="$(normpath "$(pwd)/${from}")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -52,9 +52,11 @@ done
|
|||||||
local files=($(find "$from" -type f))
|
local files=($(find "$from" -type f))
|
||||||
for file in "${files[@]}" ; do
|
for file in "${files[@]}" ; do
|
||||||
file=${file#${from}}
|
file=${file#${from}}
|
||||||
|
f=$(normpath "${from}/${file}")
|
||||||
|
t=$(normpath "${to}/${file}")
|
||||||
[ $QUIET ] \
|
[ $QUIET ] \
|
||||||
|| echo "copy: \"${from}/${file}\" -> $id:\"${to}/${file}\""
|
|| echo "copy: \"$f\" -> $id:\"$t\""
|
||||||
pct push $id "${from}/${file}" "${to}/${file}"
|
pct push $id "$f" "$t"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user