uvol: fix regression in handling fractional megabytes free
authorPhilip Prindeville <philipp@redfish-solutions.com>
Wed, 18 Jan 2023 22:33:30 +0000 (15:33 -0700)
committerDaniel Golle <daniel@makrotopia.org>
Mon, 23 Jan 2023 01:31:52 +0000 (01:31 +0000)
Also, fix off-by-one issue when computing free size.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
utils/uvol/Makefile
utils/uvol/files/autopart.defaults

index ab2f8ba616230d4be350a20e7416add5b9d3cf89..591a6a6455ca2ee9fa0e754d56973b5b012ac165 100644 (file)
@@ -1,8 +1,8 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=uvol
-PKG_VERSION:=0.8
-PKG_RELEASE:=$(AUTORELEASE)
+PKG_VERSION:=0.9
+PKG_RELEASE:=1
 
 PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
 PKG_LICENSE:=GPL-2.0-or-later
index 99ea09406b9e4bb561aa2cec86e6eb4ca3c909a7..007dd3e2e184f3d5ecc8dda25484d6c940fced16 100644 (file)
@@ -56,23 +56,14 @@ part_fixup() {
 
 get_free_area() {
        local found=
-       sfdisk -q -F "$1" 2>/dev/null | while read -r start end sectors size; do
+       sfdisk --bytes -q -F "$1" 2>/dev/null | while read -r start end sectors size; do
                case $start in
                *"Unpartitioned"* | *"Units:"* | *"Sector"* | *"Start"* )
                        continue
                        ;;
                [0-9]*)
-                       case "$size" in
-                               *"k" | *"b")
-                                       continue
-                                       ;;
-                               *"M")
-                                       [ "${size%%.*M}" -lt 100 ] && continue
-                                       ;;
-                               *"G" | *"T")
-                                       ;;
-                       esac
-                       [ "$found" ] || echo "start=$start, size=$((end - start))"
+                       [ $size" -lt $((100 * 1024 * 1024)) ] && continue
+                       [ "$found" ] || echo "start=$start, size=$sectors"
                        found=1
                        ;;
                esac