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)

This commit is contained in:
Silvan Calarco 2012-01-09 19:44:34 +01:00
parent 80f07e03ce
commit 6535897c9b

View File

@ -213,10 +213,13 @@ set_status "Copia del file iso di openmamba in corso..."
ORIG_SIZE=`stat -c %s $SELECT_ISO` ORIG_SIZE=`stat -c %s $SELECT_ISO`
cp $SELECT_ISO ./ & cp $SELECT_ISO ./ &
DEST_SIZE=0 DEST_SIZE=0
DEST_FILE=./"`basename $SELECT_ISO`"
while [ $ORIG_SIZE -gt $DEST_SIZE ]; do 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 )) percentuale=$((45 + ( 50 * $DEST_SIZE ) / $ORIG_SIZE ))
set_pbar $percentuale set_pbar $percentuale
fi
sleep 2 sleep 2
done done
ln -fs `basename $SELECT_ISO` ./openmamba-live.iso ln -fs `basename $SELECT_ISO` ./openmamba-live.iso