diff options
author | Martin ร berg <martin@fripost.org> | 2021-08-17 18:27:55 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-18 10:59:50 +0200 |
commit | 0ed2a03450cc50b0f307fd2a8d04bf645e02d9d6 (patch) | |
tree | d857f979762af00ae5e19be0a1dde653f8007539 | |
parent | dd0244a97dd71501ede69ec1ed1ff2eaee320f28 (diff) | |
download | serenity-0ed2a03450cc50b0f307fd2a8d04bf645e02d9d6.zip |
Meta: Assume and find GNU du
We want to use use the 'du' option '--apparent-size' which is a
GNU coreutils extension. GNU coreutils is a build dependency so
we know it is available. With this commit we first try to pick up
du as 'gdu', and if that fails, try 'du' instead.
-rwxr-xr-x | Meta/build-image-qemu.sh | 14 |
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() { |