From 3a7f15aa3253b274377cb03441e673da28a00f4e Mon Sep 17 00:00:00 2001 From: tw93 Date: Thu, 29 Jan 2026 11:15:14 +0800 Subject: [PATCH] fix(check): use numeric df output for disk space --- lib/check/all.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/check/all.sh b/lib/check/all.sh index ee100cd..1126826 100644 --- a/lib/check/all.sh +++ b/lib/check/all.sh @@ -422,8 +422,11 @@ get_macos_update_labels() { # ============================================================================ check_disk_space() { - local free_gb=$(command df -H / | awk 'NR==2 {print $4}' | sed 's/G//') - local free_num=$(echo "$free_gb" | tr -d 'G' | cut -d'.' -f1) + # Use df -k to get KB values (always numeric), then calculate GB via math + # This avoids unit suffix parsing issues (df -H can return MB or GB) + local free_kb=$(command df -k / | awk 'NR==2 {print $4}') + local free_gb=$(awk "BEGIN {printf \"%.1f\", $free_kb / 1048576}") + local free_num=$(awk "BEGIN {printf \"%d\", $free_kb / 1048576}") export DISK_FREE_GB=$free_num