uvol: fix autopart handling double/float number
authorDaniel Golle <daniel@makrotopia.org>
Sun, 14 Aug 2022 18:51:37 +0000 (20:51 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 14 Aug 2022 18:51:37 +0000 (20:51 +0200)
Consider only integer part of free space in megabytes when
deciding the boundaries of the to be created partition.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
utils/uvol/files/autopart.defaults

index 870cd441569e1dcc9f3b585dc30185dc4218fbc9..99ea09406b9e4bb561aa2cec86e6eb4ca3c909a7 100644 (file)
@@ -63,14 +63,14 @@ get_free_area() {
                        ;;
                [0-9]*)
                        case "$size" in
+                               *"k" | *"b")
+                                       continue
+                                       ;;
                                *"M")
-                                       [ "${size%%M}" -lt 100 ] && continue
+                                       [ "${size%%.*M}" -lt 100 ] && continue
                                        ;;
                                *"G" | *"T")
                                        ;;
-                               *"k" | *"b")
-                                       continue
-                                       ;;
                        esac
                        [ "$found" ] || echo "start=$start, size=$((end - start))"
                        found=1