Skip to content

Commit

Permalink
New: copy with progress if possible
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Safr <Miroslav.Safr@gmail.com>
  • Loading branch information
safrm committed Jun 22, 2014
1 parent a526d69 commit 0d70e02
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rvmb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ alias echo="/bin/echo -e"
debug(){ [ ${DEBUG_FLAG:-0} -eq 0 ] || echo "Running($#): $*"; }
verbose(){ [ ${VERBOSE_FLAG:-0} -eq 0 ] || echo "\033[36m$*\033[00m"; }
fail() { printf "\n\033[01;31mERROR: $*\033[00m\n" ; exit 1 ; }

copy_with_progress() {
if command -v rsync 1>/dev/null 2>&1; then rsync -avI --progress $1 $2 ; else cp -f $1 $2 ; fi
}
usage() {
echo "$BASENAME ${VERSION} - Rapid VM builder for qemu-kvm"
echo " http://safrm.net/projects/rvmo/"
Expand Down Expand Up @@ -213,7 +215,7 @@ rvmb_create_disk()
#clone or create
if [ -e $BASE_DISK_NAME.$DISK_FORMAT_EXT -a -n $CLONE_NO ]; then
verbose "Copying image: $BASE_DISK_NAME.$DISK_FORMAT_EXT to $DISK_NAME.$DISK_FORMAT_EXT $DISK_SIZE"
cp -f $BASE_DISK_NAME.$DISK_FORMAT_EXT $DISK_NAME.$DISK_FORMAT_EXT
copy_with_progress $BASE_DISK_NAME.$DISK_FORMAT_EXT $DISK_NAME.$DISK_FORMAT_EXT
return 2;
else
verbose "Creating image: $DISK_NAME.$DISK_FORMAT_EXT $DISK_SIZE"
Expand Down

0 comments on commit 0d70e02

Please sign in to comment.