From d691022aef46ca0c5ac404599f1b723848258254 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Sun, 28 Feb 2021 09:28:37 +0100 Subject: [PATCH] fix: typos and backwards compatibility - forgot again assertContains isn't supported on bionic's shunit2 --- drive.inc | 10 +++++----- tests/drive.sh | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drive.inc b/drive.inc index b8d6603..9fbf728 100644 --- a/drive.inc +++ b/drive.inc @@ -34,7 +34,7 @@ function partition_list { local drive="$1" partitions="$(parted -m "$drive" -- print| \ - awk --field-separator=":" \ + awk -F: \ '{if (NR > 2) print $1 }')" @@ -43,7 +43,7 @@ function partition_list function find_unused { local drive="$1" - unused="$(parted -m "$drive" -- print|awk --field-separator=":" \ + unused="$(parted -m "$drive" -- print|awk -F: \ '{if (NR > 2 && $1 >= 2 && $6 == "root unused") { print $1 }}')|head -1" @@ -52,7 +52,7 @@ function find_unused function find_oldest { local drive="$1" - oldest="$(parted -m "$drive" -- print|awk --field-separator=":" \ + oldest="$(parted -m "$drive" -- print|awk -F: \ 'BEGIN {min="ZZZZ"} {if (NR > 2 && $1 >= 2 && $1 <= 4 && @@ -66,7 +66,7 @@ function find_oldest function find_newest { local drive="$1" - newest="$(parted -m "$drive" -- print|awk --field-separator=":" \ + newest="$(parted -m "$drive" -- print|awk -F: \ 'BEGIN {max=""} {if (NR > 2 && $1 >= 2 && $1 <= 4 && @@ -81,7 +81,7 @@ function version_from_partnum { local drive="$1" local partnum="$2" - version="$(parted -m "$drive" -- print|awk --field-separator=":" \ + version="$(parted -m "$drive" -- print|awk -F: \ '{if (NR > 2 && $1 == "'"$partnum"') { print $6 }}')" diff --git a/tests/drive.sh b/tests/drive.sh index 377a86e..0a0d43f 100755 --- a/tests/drive.sh +++ b/tests/drive.sh @@ -30,7 +30,7 @@ function test_partitioning() assertEquals "$max_version" "$version" find_unused "$img" - assertContains " 3 4 " "$unused" + assertEquals 3 "$unused" rename_partition "$img" 3 "root $min_version" find_oldest "$img" @@ -40,7 +40,7 @@ function test_partitioning() find_newest "$img" assertEquals "$max_version" "$newest" - partition-list "$img" + partition_list "$img" assertEquals "1 2 3 4 5" "$partitions" rm -f "$img"