Add sync and correct cp while

This commit is contained in:
Filippo Bedendo Bordon 2012-02-20 22:27:16 +01:00
parent 89036e3383
commit 191c9e0818

View File

@ -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"