fix: don't list versions of unused partitions

This commit is contained in:
Peter Šurda 2021-02-28 10:02:59 +01:00
parent da6118b6a0
commit 66012a64b6
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
2 changed files with 3 additions and 1 deletions

View File

@ -79,7 +79,8 @@ function version_from_partnum
local partnum="$2"
version="$(parted -m "$drive" -- print|awk -F: \
-v partnum="$partnum" \
'{if (NR > 2 && $1 == partnum) {
'{if (NR > 2 && $1 == partnum && $1 >= 2 && $1 <= 4 &&
$6 != "root unused") {
print $6
}}')"
version="$(echo "$version"|cut -d\ -f2)"

View File

@ -25,6 +25,7 @@ function test_partitioning()
find_unused "$img"
assertEquals "find_unused" 3 "$unused"
assertEquals "version_from_partnum unused" "" "$unused"
rename_partition "$img" 3 "root $min_version"
find_oldest "$img"