fix: nginx port stuff on all interface installers

This commit is contained in:
th33xitus
2020-10-06 20:19:37 +02:00
parent 9b424c8343
commit 029127bf00
4 changed files with 128 additions and 80 deletions

View File

@@ -319,18 +319,12 @@ dwc2_reverse_proxy_dialog(){
dwc2_port_check(){
if [ "$DWC2_ENABLED" = "false" ]; then
if [ "$SITE_ENABLED" = "true" ]; then
echo "Detected other enabled Interfaces:"
[ "$OCTOPRINT_ENABLED" = "true" ] && echo "${cyan}● OctoPrint - Port:$OCTOPRINT_PORT${default}"
[ "$MAINSAIL_ENABLED" = "true" ] && echo "${cyan}● Mainsail - Port:$MAINSAIL_PORT${default}"
[ "$FLUIDD_ENABLED" = "true" ] && echo "${cyan}● Fluidd - Port:$FLUIDD_PORT${default}"
status_msg "Detected other enabled interfaces:"
[ "$OCTOPRINT_ENABLED" = "true" ] && echo " ${cyan}● OctoPrint - Port:$OCTOPRINT_PORT${default}"
[ "$MAINSAIL_ENABLED" = "true" ] && echo " ${cyan}● Mainsail - Port:$MAINSAIL_PORT${default}"
[ "$FLUIDD_ENABLED" = "true" ] && echo " ${cyan}● Fluidd - Port:$FLUIDD_PORT${default}"
if [ "$MAINSAIL_PORT" = "80" ] || [ "$OCTOPRINT_PORT" = "80" ] || [ "$FLUIDD_PORT" = "80" ]; then
PORT_80_BLOCKED="true"
fi
if [ "$PORT_80_BLOCKED" = "true" ]; then
[ "$OCTOPRINT_PORT" = "80" ] && echo "${cyan}OctoPrint${default} already listens on Port 80!"
[ "$MAINSAIL_PORT" = "80" ] && echo "${cyan}Mainsail${default} already listens on Port 80!"
[ "$FLUIDD_PORT" = "80" ] && echo "${cyan}Fluidd${default} already listens on Port 80!"
echo "You need to choose a different Port for DWC2 than the above!"
select_dwc2_port
fi
else
@@ -344,9 +338,26 @@ dwc2_port_check(){
}
select_dwc2_port(){
if [ "$PORT_80_BLOCKED" = "true" ]; then
echo
top_border
echo -e "| ${red}!!!WARNING!!!${default} |"
echo -e "| ${red}You need to choose a different port for DWC2!${default} |"
echo -e "| ${red}The following web interface is listening at port 80:${default} |"
blank_line
[ "$OCTOPRINT_PORT" = "80" ] && echo "| ● OctoPrint |"
[ "$MAINSAIL_PORT" = "80" ] && echo "| ● Mainsail |"
[ "$FLUIDD_PORT" = "80" ] && echo "| ● Fluidd |"
blank_line
echo -e "| Make sure you don't choose a port which was already |"
echo -e "| assigned to one of the other web interfaces! |"
blank_line
echo -e "| Be aware: there is ${red}NO${default} sanity check for the following |"
echo -e "| input. So make sure to choose a valid port! |"
bottom_border
while true; do
read -p "${cyan}Please enter a new Port:${default} " NEW_PORT
if [ "$NEW_PORT" != "$MAINSAIL_PORT" ] && [ "$NEW_PORT" != "$OCTOPRINT_PORT" ] && [ "$NEW_PORT" != "$FLUIDD_PORT" ]; then
if [ "$NEW_PORT" != "$MAINSAIL_PORT" ] && [ "$NEW_PORT" != "$FLUIDD_PORT" ] && [ "$NEW_PORT" != "$OCTOPRINT_PORT" ]; then
echo "Setting port $NEW_PORT for DWC2!"
SET_LISTEN_PORT=$NEW_PORT
break
@@ -354,4 +365,5 @@ select_dwc2_port(){
echo "That port is already taken! Select a different one!"
fi
done
fi
}

View File

@@ -14,18 +14,12 @@ install_fluidd(){
fluidd_port_check(){
if [ "$FLUIDD_ENABLED" = "false" ]; then
if [ "$SITE_ENABLED" = "true" ]; then
echo "Detected other enabled Interfaces:"
[ "$MAINSAIL_ENABLED" = "true" ] && echo "${cyan}Mainsail - Port:$MAINSAIL_PORT${default}"
[ "$DWC2_ENABLED" = "true" ] && echo "${cyan}DWC2 - Port:$DWC2_PORT${default}"
[ "$OCTOPRINT_ENABLED" = "true" ] && echo "${cyan}OctoPrint - Port:$OCTOPRINT_PORT${default}"
status_msg "Detected other enabled interfaces:"
[ "$OCTOPRINT_ENABLED" = "true" ] && echo " ${cyan}OctoPrint - Port: $OCTOPRINT_PORT${default}"
[ "$MAINSAIL_ENABLED" = "true" ] && echo " ${cyan}Mainsail - Port: $MAINSAIL_PORT${default}"
[ "$DWC2_ENABLED" = "true" ] && echo " ${cyan}DWC2 - Port: $DWC2_PORT${default}"
if [ "$MAINSAIL_PORT" = "80" ] || [ "$DWC2_PORT" = "80" ] || [ "$OCTOPRINT_PORT" = "80" ]; then
PORT_80_BLOCKED="true"
fi
if [ "$PORT_80_BLOCKED" = "true" ]; then
[ "$MAINSAIL_PORT" = "80" ] && echo "${cyan}Mainsail${default} already listens on Port 80!"
[ "$DWC2_PORT" = "80" ] && echo "${cyan}DWC2${default} already listens on Port 80!"
[ "$OCTOPRINT_PORT" = "80" ] && echo "${cyan}OctoPrint${default} already listens on Port 80!"
echo "You need to choose a different Port for Fluidd than the above!"
select_fluidd_port
fi
else
@@ -39,16 +33,34 @@ fluidd_port_check(){
}
select_fluidd_port(){
if [ "$PORT_80_BLOCKED" = "true" ]; then
echo
top_border
echo -e "| ${red}!!!WARNING!!!${default} |"
echo -e "| ${red}You need to choose a different port for Fluidd!${default} |"
echo -e "| ${red}The following web interface is listening at port 80:${default} |"
blank_line
[ "$OCTOPRINT_PORT" = "80" ] && echo "| ● OctoPrint |"
[ "$MAINSAIL_PORT" = "80" ] && echo "| ● Mainsail |"
[ "$DWC2_PORT" = "80" ] && echo "| ● DWC2 |"
blank_line
echo -e "| Make sure you don't choose a port which was already |"
echo -e "| assigned to one of the other web interfaces! |"
blank_line
echo -e "| Be aware: there is ${red}NO${default} sanity check for the following |"
echo -e "| input. So make sure to choose a valid port! |"
bottom_border
while true; do
read -p "${cyan}Please enter a new Port:${default} " NEW_PORT
if [ "$NEW_PORT" != "$MAINSAIL_PORT" ] && [ "$NEW_PORT" != "$DWC2_PORT" ] && [ "$NEW_PORT" != "$OCTOPRINT_PORT" ]; then
echo "Setting port $NEW_PORT for Mainsail!"
echo "Setting port $NEW_PORT for Fluidd!"
SET_LISTEN_PORT=$NEW_PORT
break
else
echo "That port is already taken! Select a different one!"
fi
done
fi
}
get_fluidd_ver(){

View File

@@ -14,18 +14,12 @@ install_mainsail(){
mainsail_port_check(){
if [ "$MAINSAIL_ENABLED" = "false" ]; then
if [ "$SITE_ENABLED" = "true" ]; then
echo "Detected other enabled Interfaces:"
[ "$FLUIDD_ENABLED" = "true" ] && echo "${cyan}Fluidd - Port:$FLUIDD_PORT${default}"
[ "$DWC2_ENABLED" = "true" ] && echo "${cyan}DWC2 - Port:$DWC2_PORT${default}"
[ "$OCTOPRINT_ENABLED" = "true" ] && echo "${cyan}OctoPrint - Port:$OCTOPRINT_PORT${default}"
status_msg "Detected other enabled interfaces:"
[ "$OCTOPRINT_ENABLED" = "true" ] && echo -e " ${cyan}OctoPrint - Port: $OCTOPRINT_PORT${default}"
[ "$FLUIDD_ENABLED" = "true" ] && echo -e " ${cyan}Fluidd - Port: $FLUIDD_PORT${default}"
[ "$DWC2_ENABLED" = "true" ] && echo -e " ${cyan}DWC2 - Port: $DWC2_PORT${default}"
if [ "$FLUIDD_PORT" = "80" ] || [ "$DWC2_PORT" = "80" ] || [ "$OCTOPRINT_PORT" = "80" ]; then
PORT_80_BLOCKED="true"
fi
if [ "$PORT_80_BLOCKED" = "true" ]; then
[ "$FLUIDD_PORT" = "80" ] && echo "${cyan}Fluidd${default} already listens on Port 80!"
[ "$DWC2_PORT" = "80" ] && echo "${cyan}DWC2${default} already listens on Port 80!"
[ "$OCTOPRINT_PORT" = "80" ] && echo "${cyan}OctoPrint${default} already listens on Port 80!"
echo "You need to choose a different Port for Mainsail than the above!"
select_mainsail_port
fi
else
@@ -39,6 +33,23 @@ mainsail_port_check(){
}
select_mainsail_port(){
if [ "$PORT_80_BLOCKED" = "true" ]; then
echo
top_border
echo -e "| ${red}!!!WARNING!!!${default} |"
echo -e "| ${red}You need to choose a different port for Mainsail!${default} |"
echo -e "| ${red}The following web interface is listening at port 80:${default} |"
blank_line
[ "$OCTOPRINT_PORT" = "80" ] && echo "| ● OctoPrint |"
[ "$FLUIDD_PORT" = "80" ] && echo "| ● Fluidd |"
[ "$DWC2_PORT" = "80" ] && echo "| ● DWC2 |"
blank_line
echo -e "| Make sure you don't choose a port which was already |"
echo -e "| assigned to one of the other web interfaces! |"
blank_line
echo -e "| Be aware: there is ${red}NO${default} sanity check for the following |"
echo -e "| input. So make sure to choose a valid port! |"
bottom_border
while true; do
read -p "${cyan}Please enter a new Port:${default} " NEW_PORT
if [ "$NEW_PORT" != "$FLUIDD_PORT" ] && [ "$NEW_PORT" != "$DWC2_PORT" ] && [ "$NEW_PORT" != "$OCTOPRINT_PORT" ]; then
@@ -49,6 +60,7 @@ select_mainsail_port(){
echo "That port is already taken! Select a different one!"
fi
done
fi
}
get_mainsail_ver(){

View File

@@ -142,18 +142,12 @@ octoprint_reverse_proxy_dialog(){
octoprint_port_check(){
if [ "$OCTOPRINT_ENABLED" = "false" ]; then
if [ "$SITE_ENABLED" = "true" ]; then
echo "Detected other enabled Interfaces:"
[ "$MAINSAIL_ENABLED" = "true" ] && echo "${cyan}● Mainsail - Port:$MAINSAIL_PORT${default}"
[ "$FLUIDD_ENABLED" = "true" ] && echo "${cyan}● Fluidd - Port:$FLUIDD_PORT${default}"
[ "$DWC2_ENABLED" = "true" ] && echo "${cyan}● DWC2 - Port:$DWC2_PORT${default}"
status_msg "Detected other enabled interfaces:"
[ "$MAINSAIL_ENABLED" = "true" ] && echo " ${cyan}● Mainsail - Port:$MAINSAIL_PORT${default}"
[ "$FLUIDD_ENABLED" = "true" ] && echo " ${cyan}● Fluidd - Port:$FLUIDD_PORT${default}"
[ "$DWC2_ENABLED" = "true" ] && echo " ${cyan}● DWC2 - Port:$DWC2_PORT${default}"
if [ "$MAINSAIL_PORT" = "80" ] || [ "$DWC2_PORT" = "80" ] || [ "$FLUIDD_PORT" = "80" ]; then
PORT_80_BLOCKED="true"
fi
if [ "$PORT_80_BLOCKED" = "true" ]; then
[ "$MAINSAIL_PORT" = "80" ] && echo "${cyan}Mainsail${default} already listens on Port 80!"
[ "$FLUIDD_PORT" = "80" ] && echo "${cyan}Fluidd${default} already listens on Port 80!"
[ "$DWC2_PORT" = "80" ] && echo "${cyan}DWC2${default} already listens on Port 80!"
echo "You need to choose a different Port for OctoPrint than the above!"
select_octoprint_port
fi
else
@@ -167,9 +161,26 @@ octoprint_port_check(){
}
select_octoprint_port(){
if [ "$PORT_80_BLOCKED" = "true" ]; then
echo
top_border
echo -e "| ${red}!!!WARNING!!!${default} |"
echo -e "| ${red}You need to choose a different port for OctoPrint!${default} |"
echo -e "| ${red}The following web interface is listening at port 80:${default} |"
blank_line
[ "$MAINSAIL_PORT" = "80" ] && echo "| ● Mainsail |"
[ "$FLUIDD_PORT" = "80" ] && echo "| ● Fluidd |"
[ "$DWC2_PORT" = "80" ] && echo "| ● DWC2 |"
blank_line
echo -e "| Make sure you don't choose a port which was already |"
echo -e "| assigned to one of the other web interfaces! |"
blank_line
echo -e "| Be aware: there is ${red}NO${default} sanity check for the following |"
echo -e "| input. So make sure to choose a valid port! |"
bottom_border
while true; do
read -p "${cyan}Please enter a new Port:${default} " NEW_PORT
if [ "$NEW_PORT" != "$MAINSAIL_PORT" ] && [ "$NEW_PORT" != "$DWC2_PORT" ] && [ "$NEW_PORT" != "$FLUIDD_PORT" ]; then
if [ "$NEW_PORT" != "$MAINSAIL_PORT" ] && [ "$NEW_PORT" != "$FLUIDD_PORT" ] && [ "$NEW_PORT" != "$DWC2_PORT" ]; then
echo "Setting port $NEW_PORT for OctoPrint!"
SET_LISTEN_PORT=$NEW_PORT
break
@@ -177,6 +188,7 @@ select_octoprint_port(){
echo "That port is already taken! Select a different one!"
fi
done
fi
}
create_config_yaml(){