From 6535897c9bec2f09fa91f45ae208b427f8a3a663 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Mon, 9 Jan 2012 19:44:34 +0100 Subject: [PATCH] usbinstall.sh: add check for destination file existence in progress bar loop during copy (FIXME: in case cp returns an error and does not copy anything this becomes an infinite loop) --- src/usbinstall.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/usbinstall.sh b/src/usbinstall.sh index 8a2a799..10ae151 100755 --- a/src/usbinstall.sh +++ b/src/usbinstall.sh @@ -213,11 +213,14 @@ set_status "Copia del file iso di openmamba in corso..." ORIG_SIZE=`stat -c %s $SELECT_ISO` cp $SELECT_ISO ./ & DEST_SIZE=0 +DEST_FILE=./"`basename $SELECT_ISO`" while [ $ORIG_SIZE -gt $DEST_SIZE ]; do - DEST_SIZE=$(stat -c %s ./"`basename $SELECT_ISO`") + if [ -e $DEST_FILE ]; then + DEST_SIZE=$(stat -c %s $DEST_FILE) percentuale=$((45 + ( 50 * $DEST_SIZE ) / $ORIG_SIZE )) set_pbar $percentuale - sleep 2 + fi + sleep 2 done ln -fs `basename $SELECT_ISO` ./openmamba-live.iso popd >/dev/null