diff --git a/debootstrap.sh b/debootstrap.sh index 3362289877..fe3324d26a 100644 --- a/debootstrap.sh +++ b/debootstrap.sh @@ -36,15 +36,13 @@ ROOTSTART=$(($BOOTSTART+($BOOTSIZE*2048))) BOOTEND=$(($ROOTSTART-1)) # Create image file -while read line;do - [[ "$line" =~ "records out" ]] && - echo "$(( ${line%+*}*100/$SDSIZE +1 ))" | dialog --backtitle "$backtitle" --title "Creating blank image ($SDSIZE Mb), please wait ..." --gauge "" 5 70 -done< <( dd if=/dev/zero of=$DEST/cache/tmprootfs.raw bs=1M count=$SDSIZE 2>&1 & - pid=$! - sleep 1 - while kill -USR1 $pid 2>/dev/null;do - sleep 1 - done ) + +if [ "$OUTPUT_DIALOG" = "yes" ]; then + (pv -n -s $SDSIZE -S /dev/zero | dd status=none of=$DEST/cache/tmprootfs.raw) 2>&1 \ + | dialog --backtitle "$backtitle" --title "Creating blank image ($SDSIZE Mb), please wait ..." --gauge "" 5 70 +else + pv -p -b -r -s $SDSIZE -S /dev/zero | dd status=none of=$DEST/cache/tmprootfs.raw +fi # Find first available free device LOOP=$(losetup -f)