From 191c9e08186cf89b26148f9f4a03061f1ce0bbe0 Mon Sep 17 00:00:00 2001 From: Filippo Bedendo Bordon Date: Mon, 20 Feb 2012 22:27:16 +0100 Subject: [PATCH] Add sync and correct cp while --- src/usbinstall.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/usbinstall.sh b/src/usbinstall.sh index b4bbbd5..05e635c 100755 --- a/src/usbinstall.sh +++ b/src/usbinstall.sh @@ -291,18 +291,19 @@ cp $SELECT_ISO ./ & export CPPID=$! DEST_SIZE=0 DEST_FILE=./"`basename $SELECT_ISO`" -CPSTATE=`ps $CPPID | grep "cp"` -while [ "$CPSTATE" != "" ]; do +ps $CPPID >/dev/null +while [ $? -eq 0 ]; do if [ -e $DEST_FILE ]; then DEST_SIZE=$(stat -c %s $DEST_FILE) percentuale=$((45 + ( 50 * $DEST_SIZE ) / $ORIG_SIZE )) set_pbar $percentuale fi sleep 2 - CPSTATE=`ps $CPPID | grep "cp"` + ps $CPPID >/dev/null done ln -fs `basename $SELECT_ISO` ./openmamba-live.iso popd >/dev/null +sync set_pbar 98 set_status "Smonto la chiavetta"