mirror of
https://github.com/flynx/proxmox-utils.git
synced 2025-12-17 09:01:49 +00:00
added pct-push-r command...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
65b2d7a7fd
commit
e31edc255b
32
.pct-helpers
32
.pct-helpers
@ -13,14 +13,16 @@ CT_DIR=${CT_DIR:=/etc/pve/lxc/}
|
|||||||
#
|
#
|
||||||
#QUIET=
|
#QUIET=
|
||||||
#DRY_RUN=
|
#DRY_RUN=
|
||||||
|
ECHO_PREFIX="### "
|
||||||
@(){
|
@(){
|
||||||
if [ -z $DRY_RUN ] ; then
|
if [ -z $DRY_RUN ] ; then
|
||||||
! [ $QUIET ] \
|
! [ $QUIET ] \
|
||||||
&& echo "### $@"
|
&& echo "${ECHO_PREFIX}$@"
|
||||||
$@
|
$@
|
||||||
else
|
else
|
||||||
echo $@
|
echo $@
|
||||||
fi
|
fi
|
||||||
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -124,5 +126,33 @@ hostname2ct(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
pct-push-r(){
|
||||||
|
local id=$1
|
||||||
|
local from=$2
|
||||||
|
local to=$3
|
||||||
|
|
||||||
|
local IFS=$'\n'
|
||||||
|
|
||||||
|
local dirs=($(find "$from" -type d))
|
||||||
|
for dir in "${dirs[@]}" ; do
|
||||||
|
if [[ "$dir" == "${to}" ]] ; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
dir=${dir#${from}}
|
||||||
|
lxc-attach $id -- mkdir -p "${to}/${dir}"
|
||||||
|
done
|
||||||
|
|
||||||
|
local files=($(find "$from" -type f))
|
||||||
|
for file in "${files[@]}" ; do
|
||||||
|
file=${file#${from}}
|
||||||
|
[ $QUIET ] \
|
||||||
|
|| echo "copy: \"${from}/${file}\" -> $id:\"${to}/${file}\""
|
||||||
|
pct push $id "${from}/${file}" "${to}/${file}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# vim:set ts=4 sw=4 nowrap :
|
# vim:set ts=4 sw=4 nowrap :
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user