fix: small dwc2 related fixes

This commit is contained in:
th33xitus
2021-01-21 23:47:29 +01:00
parent d958c1ba2a
commit d9e697216f
3 changed files with 26 additions and 13 deletions

View File

@@ -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

View File

@@ -239,7 +239,7 @@ 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]
@@ -256,7 +256,7 @@ 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]

View File

@@ -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