Un1q32 / pfetch

🐧 A pretty system information tool written in POSIX sh.
MIT License
30 stars 9 forks source link

Haiku: disk #41

Closed polluks closed 2 months ago

polluks commented 2 months ago

https://github.com/Un1q32/pfetch/blob/5424c5df74931387882cfa4001f633b45497d7f3/pfetch#L1231 I cannot see the oddness https://www.markround.com/blog/2023/02/13/haiku-package-management/#filesystem-layout

Un1q32 commented 2 months ago
Screenshot 2024-09-03 at 8 22 58 AM

The info we need is total disk space, used disk space, and the percentage used. Haiku df doesn't provide enough info.

polluks commented 2 months ago

Sorry, I don't see the point


$ a=232.9; b=219.6; a=${a%.*}; b=${b%.*}; c=$((a - b))
$ echo $c / $b \($((c * 100 / a))%\)
13 / 219 (5%)
Un1q32 commented 2 months ago

I don't like the inaccuracy from having to drop decimals, but I guess it's fine.

Un1q32 commented 2 months ago

What is the full output from df -h /?

polluks commented 2 months ago

Right now I have the source handy https://github.com/haiku/haiku/blob/master/src/bin/df.cpp BTW option h is just a dummy.

Un1q32 commented 2 months ago

Got a VM running, output is wildly different so I had to write a parser just for it. I thought to manually calculate the decimal part, so no more inaccuracy. I also reworked the part that converts Digital UNIX/IRIX df output to human readable format to be able to display fractions, so that output should be better now. LMK if it works on your system.

polluks commented 2 months ago

perfect!