mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
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.
This commit is contained in:
parent
dd0244a97d
commit
0ed2a03450
1 changed files with 9 additions and 5 deletions
|
@ -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"
|
||||
|
||||
# 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
|
||||
GNUDU="du"
|
||||
fi
|
||||
|
||||
disk_usage() {
|
||||
# shellcheck disable=SC2003
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
expr "$(du -sk "$1" | cut -f1)"
|
||||
else
|
||||
expr "$(du -sk --apparent-size "$1" | cut -f1)"
|
||||
fi
|
||||
expr "$(${GNUDU} -sk --apparent-size "$1" | cut -f1)"
|
||||
}
|
||||
|
||||
inode_usage() {
|
||||
|
|
Loading…
Add table
Reference in a new issue