From aa67ff251fbc3a86bd34b7898bc9df1c5b653062 Mon Sep 17 00:00:00 2001 From: Erazem Kokot Date: Mon, 21 Jan 2019 14:24:17 +0100 Subject: [PATCH] Use rsync instead of cp for progress and advanced features --- pishrink.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pishrink.sh b/pishrink.sh index 1d68900..2319dba 100755 --- a/pishrink.sh +++ b/pishrink.sh @@ -35,7 +35,7 @@ if (( EUID != 0 )); then fi #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 if (( $? != 0 )); then echo "ERROR: $command is not installed." @@ -46,7 +46,7 @@ done #Copy to new file if requested if [ -n "$2" ]; then echo "Copying $1 to $2..." - cp --reflink=auto --sparse=always "$1" "$2" + rsync --sparse --preallocate --info=progress2 --human-readable "$1" "$2" if (( $? != 0 )); then echo "ERROR: Could not copy file..." exit -5