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=$! export CPPID=$!
DEST_SIZE=0 DEST_SIZE=0
DEST_FILE=./"`basename $SELECT_ISO`" DEST_FILE=./"`basename $SELECT_ISO`"
CPSTATE=`ps $CPPID | grep "cp"` ps $CPPID >/dev/null
while [ "$CPSTATE" != "" ]; do while [ $? -eq 0 ]; do
if [ -e $DEST_FILE ]; then if [ -e $DEST_FILE ]; then
DEST_SIZE=$(stat -c %s $DEST_FILE) 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 fi
sleep 2 sleep 2
CPSTATE=`ps $CPPID | grep "cp"` ps $CPPID >/dev/null
done done
ln -fs `basename $SELECT_ISO` ./openmamba-live.iso ln -fs `basename $SELECT_ISO` ./openmamba-live.iso
popd >/dev/null popd >/dev/null
sync
set_pbar 98 set_pbar 98
set_status "Smonto la chiavetta" set_status "Smonto la chiavetta"