From e06ca74d1d31f871782cfb9eb0107f9d616e7211 Mon Sep 17 00:00:00 2001 From: olsch01 Date: Thu, 9 Apr 2026 09:09:24 -0400 Subject: [PATCH] fix: remove bc dependency from db-backup.sh format_size function Replace bc-based floating point division with pure bash integer arithmetic so the script works on minimal Ubuntu servers without bc installed. Co-Authored-By: Claude Opus 4.6 --- scripts/db-backup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/db-backup.sh b/scripts/db-backup.sh index e4185ec..27abbf1 100755 --- a/scripts/db-backup.sh +++ b/scripts/db-backup.sh @@ -52,9 +52,9 @@ ensure_postgres_running() { format_size() { local bytes=$1 - if (( bytes >= 1073741824 )); then printf "%.1f GB" "$(echo "$bytes / 1073741824" | bc -l)" - elif (( bytes >= 1048576 )); then printf "%.1f MB" "$(echo "$bytes / 1048576" | bc -l)" - elif (( bytes >= 1024 )); then printf "%.1f KB" "$(echo "$bytes / 1024" | bc -l)" + if (( bytes >= 1073741824 )); then printf "%d.%d GB" $((bytes / 1073741824)) $(( (bytes % 1073741824) * 10 / 1073741824 )) + elif (( bytes >= 1048576 )); then printf "%d.%d MB" $((bytes / 1048576)) $(( (bytes % 1048576) * 10 / 1048576 )) + elif (( bytes >= 1024 )); then printf "%d.%d KB" $((bytes / 1024)) $(( (bytes % 1024) * 10 / 1024 )) else printf "%d B" "$bytes" fi }