mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 02:54:28 +05:00
fix: possible fix for #24
This commit is contained in:
@@ -1,14 +1,19 @@
|
|||||||
install_fluidd(){
|
install_fluidd(){
|
||||||
if [ "$INST_FLUIDD" = "true" ]; then
|
if [ "$INST_FLUIDD" = "true" ]; then
|
||||||
unset SET_LISTEN_PORT
|
#check if moonraker is already installed
|
||||||
|
check_moonraker
|
||||||
|
if [ "$MOONRAKER_SERVICE_FOUND" = "true" ]; then
|
||||||
#check for other enabled web interfaces
|
#check for other enabled web interfaces
|
||||||
|
unset SET_LISTEN_PORT
|
||||||
detect_enabled_sites
|
detect_enabled_sites
|
||||||
#check if another site already listens to port 80
|
#check if another site already listens to port 80
|
||||||
fluidd_port_check
|
fluidd_port_check
|
||||||
#creating the fluidd nginx cfg
|
#creating the fluidd nginx cfg
|
||||||
set_nginx_cfg "fluidd"
|
set_nginx_cfg "fluidd"
|
||||||
|
test_nginx "$SET_LISTEN_PORT"
|
||||||
fluidd_setup
|
fluidd_setup
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
fluidd_port_check(){
|
fluidd_port_check(){
|
||||||
|
|||||||
@@ -1,14 +1,31 @@
|
|||||||
install_mainsail(){
|
install_mainsail(){
|
||||||
if [ "$INST_MAINSAIL" = "true" ]; then
|
if [ "$INST_MAINSAIL" = "true" ]; then
|
||||||
unset SET_LISTEN_PORT
|
#check if moonraker is already installed
|
||||||
|
check_moonraker
|
||||||
|
if [ "$MOONRAKER_SERVICE_FOUND" = "true" ]; then
|
||||||
#check for other enabled web interfaces
|
#check for other enabled web interfaces
|
||||||
|
unset SET_LISTEN_PORT
|
||||||
detect_enabled_sites
|
detect_enabled_sites
|
||||||
#check if another site already listens to port 80
|
#check if another site already listens to port 80
|
||||||
mainsail_port_check
|
mainsail_port_check
|
||||||
#creating the mainsail nginx cfg
|
#creating the mainsail nginx cfg
|
||||||
set_nginx_cfg "mainsail"
|
set_nginx_cfg "mainsail"
|
||||||
|
test_nginx "$SET_LISTEN_PORT"
|
||||||
mainsail_setup && ok_msg "Mainsail installation complete!"; echo
|
mainsail_setup && ok_msg "Mainsail installation complete!"; echo
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_moonraker(){
|
||||||
|
status_msg "Checking for Moonraker service ..."
|
||||||
|
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "moonraker.service")" ]; then
|
||||||
|
ok_msg "Moonraker service found!"; echo
|
||||||
|
MOONRAKER_SERVICE_FOUND="true"
|
||||||
|
else
|
||||||
|
warn_msg "Moonraker service not found!"
|
||||||
|
warn_msg "Please install Moonraker first!"; echo
|
||||||
|
MOONRAKER_SERVICE_FOUND="false"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
mainsail_port_check(){
|
mainsail_port_check(){
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ install_moonraker(){
|
|||||||
restart_moonraker
|
restart_moonraker
|
||||||
restart_klipper
|
restart_klipper
|
||||||
test_api
|
test_api
|
||||||
#test_nginx
|
|
||||||
#install_mainsail
|
|
||||||
#install_fluidd
|
|
||||||
}
|
}
|
||||||
|
|
||||||
system_check_moonraker(){
|
system_check_moonraker(){
|
||||||
@@ -680,13 +677,4 @@ test_api(){
|
|||||||
else
|
else
|
||||||
echo; warn_msg "Klipper API not working correctly!"; echo
|
echo; warn_msg "Klipper API not working correctly!"; echo
|
||||||
fi
|
fi
|
||||||
status_msg "Testing Nginx ..."
|
|
||||||
status_msg "Please wait ..."
|
|
||||||
status_msg "API response from http://"$HOST_IP"/printer/info :"
|
|
||||||
echo -e "${cyan}$(curl -s "http://"$HOST_IP"/printer/info")${default}"
|
|
||||||
if [ $(curl -s "http://"$HOST_IP"/printer/info" | grep '^{"result"' -c) -eq 1 ]; then
|
|
||||||
echo; ok_msg "Nginx is working correctly!"; echo
|
|
||||||
else
|
|
||||||
echo; warn_msg "Nginx is not working correctly!"; echo
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
@@ -39,6 +39,20 @@ read_listen_port(){
|
|||||||
LISTEN_PORT=$(grep listen /etc/nginx/sites-enabled/$1 | head -1 | sed 's/^\s*//' | cut -d" " -f2 | cut -d";" -f1)
|
LISTEN_PORT=$(grep listen /etc/nginx/sites-enabled/$1 | head -1 | sed 's/^\s*//' | cut -d" " -f2 | cut -d";" -f1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_nginx(){
|
||||||
|
HOST_IP=$(hostname -I | cut -d" " -f1)
|
||||||
|
status_msg "Testing NGINX ..."
|
||||||
|
status_msg "Please wait ..."
|
||||||
|
sleep 15
|
||||||
|
status_msg "API response from http://$HOST_IP:$1/printer/info :"
|
||||||
|
echo -e "${cyan}$(curl -s "http://"$HOST_IP:$1"/printer/info")${default}"
|
||||||
|
if [ $(curl -s "http://"$HOST_IP:$1"/printer/info" | grep '^{"result"' -c) -eq 1 ]; then
|
||||||
|
echo; ok_msg "NGINX is working correctly!"; echo
|
||||||
|
else
|
||||||
|
echo; warn_msg "NGINX is not working correctly!"; echo
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
detect_enabled_sites(){
|
detect_enabled_sites(){
|
||||||
#check if there is another UI config already installed
|
#check if there is another UI config already installed
|
||||||
#and reads the port they are listening on
|
#and reads the port they are listening on
|
||||||
|
|||||||
Reference in New Issue
Block a user