From 7ce3ac709f4a2ba6b3f513c455dedd435ec5f656 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Mon, 24 Feb 2025 09:56:46 -0500 Subject: [PATCH] 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 --- initrd/etc/functions | 5 ++--- initrd/etc/gui_functions | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/initrd/etc/functions b/initrd/etc/functions index b49bd99f..81809b4e 100644 --- a/initrd/etc/functions +++ b/initrd/etc/functions @@ -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}" diff --git a/initrd/etc/gui_functions b/initrd/etc/gui_functions index e0006020..2b370c1f 100755 --- a/initrd/etc/gui_functions +++ b/initrd/etc/gui_functions @@ -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