From ae0b3ae2f12a16094e539fd94bd371f231b1b11e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lecour?= Date: Fri, 22 Mar 2019 22:56:19 +0100 Subject: [PATCH] Use bc (instead of python) to have a rounded percentage --- evocheck.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/evocheck.sh b/evocheck.sh index 0bca172..3dd0066 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -797,8 +797,9 @@ if is_debian; then continue fi 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)))") - if [ "$percentage" -lt 5 ]; then + # Use bc to have a rounded percentage + 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!" fi done