Skip to content

Commit

Permalink
Script to display unzipping progress now stops automatically when unz…
Browse files Browse the repository at this point in the history
…ipping stops
  • Loading branch information
schuhumi committed Sep 7, 2019
1 parent 1d9876d commit a22f558
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion alpine_kindle_kual/unzip_progress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ BYTES_TOTAL="$(unzip -l /mnt/us/alpine.zip | tail -1 | cut -d' ' -f1)"
KBYTES_TOTAL="$((BYTES_TOTAL/1024))"
LIST_OF_FILES="$(unzip -l /mnt/us/alpine.zip | rev | cut -d' ' -f1 | rev | tail -n +4 | tac | tail -n +3)"
PROGRESS="0"
BYTES_EXTRACTED="0"
KBYTES_EXTRACTED="0"
KBYTES_EXTRACTED_OLD="1"
while [ "$PROGRESS" -lt "99" ] ; do
KBYTES_EXTRACTED="$(cd /mnt/us && du -k -c alpine.ext3 alpine.sh alpine.conf | grep total | tail -1 | cut -d$'\t' -f1)"
if [ "$KBYTES_EXTRACTED" == "$KBYTES_EXTRACTED_OLD" ] ; then # unzipping process stopped
break
fi
KBYTES_EXTRACTED_OLD="$KBYTES_EXTRACTED"
PROGRESS="$(($KBYTES_EXTRACTED*100/KBYTES_TOTAL))"
echo "Extracted $KBYTES_EXTRACTED of $KBYTES_TOTAL kb.. ($PROGRESS%)"
sleep 10
Expand Down

0 comments on commit a22f558

Please sign in to comment.