diff --git a/kiauh.sh b/kiauh.sh index cebfa29..9183f3a 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -32,7 +32,6 @@ FLUIDD_DIR=${HOME}/fluidd #dwc2 DWC2FK_DIR=${HOME}/dwc2-for-klipper-socket DWC_ENV_DIR=${HOME}/dwc-env -#DWC2_DIR=${HOME}/sdcard/web DWC2_DIR=${HOME}/duetwebcontrol #octoprint OCTOPRINT_DIR=${HOME}/OctoPrint diff --git a/scripts/install_dwc2.sh b/scripts/install_dwc2.sh index 60fb04b..963fe8f 100755 --- a/scripts/install_dwc2.sh +++ b/scripts/install_dwc2.sh @@ -239,15 +239,15 @@ create_single_dwcfk_cfg(){ /bin/sh -c "cat > $DWC_CONF_LOC/dwc2.cfg" << DWCCFG [webserver] listen_adress: 0.0.0.0 -web_root: ~/duetwebcontrol +web_root: ${HOME}/duetwebcontrol port: ${PORT} [reply_filters] regex: - max_accel: \d+.\d+ - max_accel_to_decel: \d+.\d+ - square_corner_velocity: \d+.\d+ - max_velocity: \d+.\d+ + max_accel: \d+.\d+ + max_accel_to_decel: \d+.\d+ + square_corner_velocity: \d+.\d+ + max_velocity: \d+.\d+ DWCCFG } @@ -256,15 +256,15 @@ create_multi_dwcfk_cfg(){ /bin/sh -c "cat > $DWC_CONF_LOC/printer_$INSTANCE/dwc2.cfg" << DWCCFG [webserver] listen_adress: 0.0.0.0 -web_root: ~/duetwebcontrol +web_root: ${HOME}/duetwebcontrol port: ${PORT} [reply_filters] regex: - max_accel: \d+.\d+ - max_accel_to_decel: \d+.\d+ - square_corner_velocity: \d+.\d+ - max_velocity: \d+.\d+ + max_accel: \d+.\d+ + max_accel_to_decel: \d+.\d+ + square_corner_velocity: \d+.\d+ + max_velocity: \d+.\d+ DWCCFG } diff --git a/scripts/status.sh b/scripts/status.sh index 760ae73..f60d9ba 100755 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -50,10 +50,16 @@ klipper_status(){ dwc2_status(){ dcount=0 dwc2_data=( + SERVICE + $DWC2_DIR $DWC2FK_DIR $DWC_ENV_DIR - $DWC2_DIR ) + ### remove the "SERVICE" entry from the klipper_data array if a klipper service is installed + if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "dwc.service")" ] || [ "$(systemctl list-units --full -all -t service --no-legend | grep -E "dwc-[[:digit:]].service")" ]; then + unset dwc2_data[0] + fi + #count+1 for each found data-item from array for dd in "${dwc2_data[@]}" do @@ -61,8 +67,16 @@ dwc2_status(){ dcount=$(expr $dcount + 1) fi done + + ### count amount of klipper services + if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "klipper.service")" ]; then + instances=1 + else + instances=$(systemctl list-units --full -all -t service --no-legend | grep -E "klipper-[[:digit:]].service" | wc -l) + fi + if [ "$dcount" == "${#dwc2_data[*]}" ]; then - DWC2_STATUS="${green}Installed!${default} " + DWC2_STATUS="$(printf "${green}Installed: %-5s${default}" $instances)" elif [ "$dcount" == 0 ]; then DWC2_STATUS="${red}Not installed!${default} " else