Use bc (instead of python) to have a rounded percentage
This commit is contained in:
parent
4f8a9ceecc
commit
ae0b3ae2f1
|
@ -797,8 +797,9 @@ if is_debian; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
reservedBlockCount=$(dumpe2fs -h "$part" 2>/dev/null | grep -e "Reserved block count:" | grep -Eo "[0-9]+")
|
reservedBlockCount=$(dumpe2fs -h "$part" 2>/dev/null | grep -e "Reserved block count:" | grep -Eo "[0-9]+")
|
||||||
percentage=$(python -c "print(int(round(float(${reservedBlockCount})/${blockCount}*100)))")
|
# Use bc to have a rounded percentage
|
||||||
if [ "$percentage" -lt 5 ]; then
|
percentage=$(echo "scale=0; ${reservedBlockCount} * 100 / ${blockCount}" | bc)
|
||||||
|
if [ "$percentage" -lt "5" ]; then
|
||||||
failed "IS_TUNE2FS_M5" "Partition ${part} has less than 5% reserved blocks!"
|
failed "IS_TUNE2FS_M5" "Partition ${part} has less than 5% reserved blocks!"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue