functions: remove now unused calc helper, readd TRACE_FUNC and DEBUG info for future tracing and debug of now hackish bashisms.

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
This commit is contained in:
Thierry Laurion 2025-02-24 09:56:46 -05:00
parent 6f2e7cbefa
commit 7ce3ac709f
No known key found for this signature in database
GPG Key ID: 9A53E1BB3FF00461
2 changed files with 3 additions and 3 deletions

View File

@ -1190,9 +1190,6 @@ scan_boot_options() {
fi
}
calc() {
awk "BEGIN { print "$*" }"
}
# truncate a file to a size only if it is longer (busybox truncate lacks '<' and
# always sets the file size)
@ -1221,7 +1218,9 @@ fromhex_plain() {
}
print_battery_state() {
TRACE_FUNC
battery="$1"
DEBUG "Battery: $1"
battery_charge=$(awk "BEGIN {printf \"%d\", ($(cat "${battery}/charge_now")/$(cat "${battery}/charge_full")*100)}")
battery_health=$(awk "BEGIN {printf \"%d\", ($(cat "${battery}/charge_full")/$(cat "${battery}/charge_full_design")*100)}")
echo "$(basename "${battery}") ${battery_charge} ${battery_health}"

View File

@ -164,6 +164,7 @@ file_selector() {
}
show_system_info() {
TRACE_FUNC
battery_status=""
for battery in /sys/class/power_supply/BAT*; do
if [[ -d "${battery}" ]]; then