mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-03 21:08:17 +08:00
test: fix sharness disk_usage util
on bsd based systems du returns block count not bytes License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
@ -343,15 +343,18 @@ disk_usage() {
|
|||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Linux)
|
Linux)
|
||||||
DU="du -sb"
|
DU="du -sb"
|
||||||
|
M=1
|
||||||
;;
|
;;
|
||||||
FreeBSD)
|
FreeBSD)
|
||||||
DU="du -s -A -B 1"
|
DU="du -s -A -B 1"
|
||||||
|
M=512
|
||||||
;;
|
;;
|
||||||
Darwin | DragonFly | *)
|
Darwin | DragonFly | *)
|
||||||
DU="du -s"
|
DU="du -s"
|
||||||
|
M=512
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
$DU "$1" | awk "{print \$1}"
|
expr $($DU "$1" | awk "{print \$1}") "*" "$M"
|
||||||
}
|
}
|
||||||
|
|
||||||
# output a file's permission in human readable format
|
# output a file's permission in human readable format
|
||||||
|
Reference in New Issue
Block a user