summaryrefslogtreecommitdiff
path: root/Meta/build-image-qemu.sh
diff options
context:
space:
mode:
Diffstat (limited to 'Meta/build-image-qemu.sh')
-rwxr-xr-xMeta/build-image-qemu.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/Meta/build-image-qemu.sh b/Meta/build-image-qemu.sh
index 4dc8726804..87d4560940 100755
--- a/Meta/build-image-qemu.sh
+++ b/Meta/build-image-qemu.sh
@@ -30,13 +30,17 @@ PATH="$SCRIPT_DIR/../Toolchain/Local/qemu/bin:$PATH"
# directory was changed to Toolchain/Local/qemu.
PATH="$SCRIPT_DIR/../Toolchain/Local/i686/bin:$PATH"
-disk_usage() {
- # shellcheck disable=SC2003
-if [ "$(uname -s)" = "Darwin" ]; then
- expr "$(du -sk "$1" | cut -f1)"
+# We depend on GNU coreutils du for the --apparent-size extension.
+# GNU coreutils is a build dependency.
+if type gdu > /dev/null 2>&1; then
+ GNUDU="gdu"
else
- expr "$(du -sk --apparent-size "$1" | cut -f1)"
+ GNUDU="du"
fi
+
+disk_usage() {
+ # shellcheck disable=SC2003
+ expr "$(${GNUDU} -sk --apparent-size "$1" | cut -f1)"
}
inode_usage() {