Use rsync instead of cp for progress and advanced features
This commit is contained in:
parent
76d2254d90
commit
aa67ff251f
|
@ -35,7 +35,7 @@ if (( EUID != 0 )); then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Check that what we need is installed
|
#Check that what we need is installed
|
||||||
for command in parted losetup tune2fs md5sum e2fsck resize2fs; do
|
for command in parted losetup tune2fs md5sum e2fsck resize2fs rsync; do
|
||||||
which $command 2>&1 >/dev/null
|
which $command 2>&1 >/dev/null
|
||||||
if (( $? != 0 )); then
|
if (( $? != 0 )); then
|
||||||
echo "ERROR: $command is not installed."
|
echo "ERROR: $command is not installed."
|
||||||
|
@ -46,7 +46,7 @@ done
|
||||||
#Copy to new file if requested
|
#Copy to new file if requested
|
||||||
if [ -n "$2" ]; then
|
if [ -n "$2" ]; then
|
||||||
echo "Copying $1 to $2..."
|
echo "Copying $1 to $2..."
|
||||||
cp --reflink=auto --sparse=always "$1" "$2"
|
rsync --sparse --preallocate --info=progress2 --human-readable "$1" "$2"
|
||||||
if (( $? != 0 )); then
|
if (( $? != 0 )); then
|
||||||
echo "ERROR: Could not copy file..."
|
echo "ERROR: Could not copy file..."
|
||||||
exit -5
|
exit -5
|
||||||
|
|
Loading…
Reference in New Issue