From: Andrea R. <ar...@sy...> - 2006-05-24 08:24:47
|
Author: arighi Date: 2006-05-24 03:24:36 -0500 (Wed, 24 May 2006) New Revision: 3585 Modified: trunk/initrd_source/skel/etc/init.d/functions Log: fix: do not report negative values for speed and status Modified: trunk/initrd_source/skel/etc/init.d/functions =================================================================== --- trunk/initrd_source/skel/etc/init.d/functions 2006-05-23 22:01:34 UTC (rev 3584) +++ trunk/initrd_source/skel/etc/init.d/functions 2006-05-24 08:24:36 UTC (rev 3585) @@ -1568,11 +1568,12 @@ # Evaluate bandwidth. speed=`echo "scale=2; (($TOT - $DISKSIZE) - $CURR_SIZE) / $REPORT_INTERVAL" | bc` + speed=`echo "scale=2; if ($speed >= 0) { print $speed; } else { print 0; }" | bc` # Evaluate status. CURR_SIZE=$(($TOT - $DISKSIZE)) status=`echo "scale=2; $CURR_SIZE * 100 / $IMAGESIZE" | bc` - if [ `echo "scale=2; $status == 0" | bc` -eq 1 ]; then + if [ `echo "scale=2; $status <= 0" | bc` -eq 1 ]; then status=1 elif [ `echo "scale=2; $status >= 100" | bc` -eq 1 ]; then status=99 |