🐛 free-gigs: actually make it work on busybox

This commit is contained in:
neingeist 2025-08-26 23:11:25 +02:00
parent beba25bd1f
commit 7e91deb06b

View file

@ -19,10 +19,11 @@ if free_bytes=$(stat -f --format="%a*%S" "$target" 2>/dev/null); then
:
elif free_bytes=$(stat -f "%a*%S" "$target" 2>/dev/null); then
# BSD/macOS stat
# XXX untested
:
else
# BusyBox stat fallback
free_bytes=$(stat -f "$target" | awk '/Block size:/ {bs=$3} /Available:/ {av=$2} END {print av*bs}')
free_bytes=$(stat -f -c "%a*%S" "$target")
fi
free_gb=$((free_bytes / factor / factor / factor))