chore: refactor how klipper services are count

This commit is contained in:
th33xitus
2021-11-11 12:12:43 +01:00
parent f7cb3d6c97
commit 4c34245da0

View File

@@ -45,10 +45,10 @@ moonraker_setup_dialog(){
shopt -u extglob # disable extended globbing
### count amount of klipper services
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "klipper.service")" ]; then
if ls /etc/systemd/system/klipper.service 2>/dev/null; then
INSTANCE_COUNT=1
else
INSTANCE_COUNT=$(systemctl list-units --full -all -t service --no-legend | grep -E "klipper-[[:digit:]]+.service" | wc -l)
INSTANCE_COUNT=$(ls /etc/systemd/system | grep -E "klipper-[[:digit:]]+.service" | wc -l)
fi
### initial moonraker.conf path check