refactor(moonraker.sh): reduce function calls

Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
th33xitus
2022-04-03 18:27:11 +02:00
parent c6d7ba8f9c
commit 81b69d455a

View File

@@ -61,11 +61,13 @@ function moonraker_setup_dialog(){
print_error "${error}" && return print_error "${error}" && return
fi fi
local klipper_count
klipper_count=$(klipper_systemd | wc -w)
top_border top_border
if [ -f "${INITD}/klipper" ] || [ -f "${SYSTEMD}/klipper.service" ]; then if [ -f "${INITD}/klipper" ] || [ -f "${SYSTEMD}/klipper.service" ]; then
printf "|${green}%-55s${white}|\n" " 1 Klipper instance was found!" printf "|${green}%-55s${white}|\n" " 1 Klipper instance was found!"
elif [ "$(klipper_systemd | wc -w)" -gt 1 ]; then elif [ "${klipper_count}" -gt 1 ]; then
printf "|${green}%-55s${white}|\n" " $(klipper_systemd | wc -w) Klipper instances were found!" printf "|${green}%-55s${white}|\n" " ${klipper_count} Klipper instances were found!"
else else
echo -e "| ${yellow}INFO: No existing Klipper installation found!${default} |" echo -e "| ${yellow}INFO: No existing Klipper installation found!${default} |"
fi fi