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(){ dwc2_port_check(){
if [ "$DWC2_ENABLED" = "false" ]; then if [ "$DWC2_ENABLED" = "false" ]; then
if [ "$SITE_ENABLED" = "true" ]; then if [ "$SITE_ENABLED" = "true" ]; then
echo "Detected other enabled Interfaces:" status_msg "Detected other enabled interfaces:"
[ "$OCTOPRINT_ENABLED" = "true" ] && echo "${cyan}● OctoPrint - Port:$OCTOPRINT_PORT${default}" [ "$OCTOPRINT_ENABLED" = "true" ] && echo " ${cyan}● OctoPrint - Port:$OCTOPRINT_PORT${default}"
[ "$MAINSAIL_ENABLED" = "true" ] && echo "${cyan}● Mainsail - Port:$MAINSAIL_PORT${default}" [ "$MAINSAIL_ENABLED" = "true" ] && echo " ${cyan}● Mainsail - Port:$MAINSAIL_PORT${default}"
[ "$FLUIDD_ENABLED" = "true" ] && echo "${cyan}● Fluidd - Port:$FLUIDD_PORT${default}" [ "$FLUIDD_ENABLED" = "true" ] && echo " ${cyan}● Fluidd - Port:$FLUIDD_PORT${default}"
if [ "$MAINSAIL_PORT" = "80" ] || [ "$OCTOPRINT_PORT" = "80" ] || [ "$FLUIDD_PORT" = "80" ]; then if [ "$MAINSAIL_PORT" = "80" ] || [ "$OCTOPRINT_PORT" = "80" ] || [ "$FLUIDD_PORT" = "80" ]; then
PORT_80_BLOCKED="true" 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 select_dwc2_port
fi fi
else else
@@ -344,14 +338,32 @@ dwc2_port_check(){
} }
select_dwc2_port(){ select_dwc2_port(){
while true; do if [ "$PORT_80_BLOCKED" = "true" ]; then
read -p "${cyan}Please enter a new Port:${default} " NEW_PORT echo
if [ "$NEW_PORT" != "$MAINSAIL_PORT" ] && [ "$NEW_PORT" != "$OCTOPRINT_PORT" ] && [ "$NEW_PORT" != "$FLUIDD_PORT" ]; then top_border
echo "Setting port $NEW_PORT for DWC2!" echo -e "| ${red}!!!WARNING!!!${default} |"
SET_LISTEN_PORT=$NEW_PORT echo -e "| ${red}You need to choose a different port for DWC2!${default} |"
break echo -e "| ${red}The following web interface is listening at port 80:${default} |"
else blank_line
echo "That port is already taken! Select a different one!" [ "$OCTOPRINT_PORT" = "80" ] && echo "| ● OctoPrint |"
fi [ "$MAINSAIL_PORT" = "80" ] && echo "| ● Mainsail |"
done [ "$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" != "$FLUIDD_PORT" ] && [ "$NEW_PORT" != "$OCTOPRINT_PORT" ]; then
echo "Setting port $NEW_PORT for DWC2!"
SET_LISTEN_PORT=$NEW_PORT
break
else
echo "That port is already taken! Select a different one!"
fi
done
fi
} }

View File

@@ -14,18 +14,12 @@ install_fluidd(){
fluidd_port_check(){ fluidd_port_check(){
if [ "$FLUIDD_ENABLED" = "false" ]; then if [ "$FLUIDD_ENABLED" = "false" ]; then
if [ "$SITE_ENABLED" = "true" ]; then if [ "$SITE_ENABLED" = "true" ]; then
echo "Detected other enabled Interfaces:" status_msg "Detected other enabled interfaces:"
[ "$MAINSAIL_ENABLED" = "true" ] && echo "${cyan}Mainsail - Port:$MAINSAIL_PORT${default}" [ "$OCTOPRINT_ENABLED" = "true" ] && echo " ${cyan}OctoPrint - Port: $OCTOPRINT_PORT${default}"
[ "$DWC2_ENABLED" = "true" ] && echo "${cyan}DWC2 - Port:$DWC2_PORT${default}" [ "$MAINSAIL_ENABLED" = "true" ] && echo " ${cyan}Mainsail - Port: $MAINSAIL_PORT${default}"
[ "$OCTOPRINT_ENABLED" = "true" ] && echo "${cyan}OctoPrint - Port:$OCTOPRINT_PORT${default}" [ "$DWC2_ENABLED" = "true" ] && echo " ${cyan}DWC2 - Port: $DWC2_PORT${default}"
if [ "$MAINSAIL_PORT" = "80" ] || [ "$DWC2_PORT" = "80" ] || [ "$OCTOPRINT_PORT" = "80" ]; then if [ "$MAINSAIL_PORT" = "80" ] || [ "$DWC2_PORT" = "80" ] || [ "$OCTOPRINT_PORT" = "80" ]; then
PORT_80_BLOCKED="true" 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 select_fluidd_port
fi fi
else else
@@ -39,16 +33,34 @@ fluidd_port_check(){
} }
select_fluidd_port(){ select_fluidd_port(){
while true; do if [ "$PORT_80_BLOCKED" = "true" ]; then
read -p "${cyan}Please enter a new Port:${default} " NEW_PORT echo
if [ "$NEW_PORT" != "$MAINSAIL_PORT" ] && [ "$NEW_PORT" != "$DWC2_PORT" ] && [ "$NEW_PORT" != "$OCTOPRINT_PORT" ]; then top_border
echo "Setting port $NEW_PORT for Mainsail!" echo -e "| ${red}!!!WARNING!!!${default} |"
SET_LISTEN_PORT=$NEW_PORT echo -e "| ${red}You need to choose a different port for Fluidd!${default} |"
break echo -e "| ${red}The following web interface is listening at port 80:${default} |"
else blank_line
echo "That port is already taken! Select a different one!" [ "$OCTOPRINT_PORT" = "80" ] && echo "| ● OctoPrint |"
fi [ "$MAINSAIL_PORT" = "80" ] && echo "| ● Mainsail |"
done [ "$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 Fluidd!"
SET_LISTEN_PORT=$NEW_PORT
break
else
echo "That port is already taken! Select a different one!"
fi
done
fi
} }
get_fluidd_ver(){ get_fluidd_ver(){

View File

@@ -14,18 +14,12 @@ install_mainsail(){
mainsail_port_check(){ mainsail_port_check(){
if [ "$MAINSAIL_ENABLED" = "false" ]; then if [ "$MAINSAIL_ENABLED" = "false" ]; then
if [ "$SITE_ENABLED" = "true" ]; then if [ "$SITE_ENABLED" = "true" ]; then
echo "Detected other enabled Interfaces:" status_msg "Detected other enabled interfaces:"
[ "$FLUIDD_ENABLED" = "true" ] && echo "${cyan}Fluidd - Port:$FLUIDD_PORT${default}" [ "$OCTOPRINT_ENABLED" = "true" ] && echo -e " ${cyan}OctoPrint - Port: $OCTOPRINT_PORT${default}"
[ "$DWC2_ENABLED" = "true" ] && echo "${cyan}DWC2 - Port:$DWC2_PORT${default}" [ "$FLUIDD_ENABLED" = "true" ] && echo -e " ${cyan}Fluidd - Port: $FLUIDD_PORT${default}"
[ "$OCTOPRINT_ENABLED" = "true" ] && echo "${cyan}OctoPrint - Port:$OCTOPRINT_PORT${default}" [ "$DWC2_ENABLED" = "true" ] && echo -e " ${cyan}DWC2 - Port: $DWC2_PORT${default}"
if [ "$FLUIDD_PORT" = "80" ] || [ "$DWC2_PORT" = "80" ] || [ "$OCTOPRINT_PORT" = "80" ]; then if [ "$FLUIDD_PORT" = "80" ] || [ "$DWC2_PORT" = "80" ] || [ "$OCTOPRINT_PORT" = "80" ]; then
PORT_80_BLOCKED="true" 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 select_mainsail_port
fi fi
else else
@@ -39,16 +33,34 @@ mainsail_port_check(){
} }
select_mainsail_port(){ select_mainsail_port(){
while true; do if [ "$PORT_80_BLOCKED" = "true" ]; then
read -p "${cyan}Please enter a new Port:${default} " NEW_PORT echo
if [ "$NEW_PORT" != "$FLUIDD_PORT" ] && [ "$NEW_PORT" != "$DWC2_PORT" ] && [ "$NEW_PORT" != "$OCTOPRINT_PORT" ]; then top_border
echo "Setting port $NEW_PORT for Mainsail!" echo -e "| ${red}!!!WARNING!!!${default} |"
SET_LISTEN_PORT=$NEW_PORT echo -e "| ${red}You need to choose a different port for Mainsail!${default} |"
break echo -e "| ${red}The following web interface is listening at port 80:${default} |"
else blank_line
echo "That port is already taken! Select a different one!" [ "$OCTOPRINT_PORT" = "80" ] && echo "| ● OctoPrint |"
fi [ "$FLUIDD_PORT" = "80" ] && echo "| ● Fluidd |"
done [ "$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
echo "Setting port $NEW_PORT for Mainsail!"
SET_LISTEN_PORT=$NEW_PORT
break
else
echo "That port is already taken! Select a different one!"
fi
done
fi
} }
get_mainsail_ver(){ get_mainsail_ver(){

View File

@@ -142,18 +142,12 @@ octoprint_reverse_proxy_dialog(){
octoprint_port_check(){ octoprint_port_check(){
if [ "$OCTOPRINT_ENABLED" = "false" ]; then if [ "$OCTOPRINT_ENABLED" = "false" ]; then
if [ "$SITE_ENABLED" = "true" ]; then if [ "$SITE_ENABLED" = "true" ]; then
echo "Detected other enabled Interfaces:" status_msg "Detected other enabled interfaces:"
[ "$MAINSAIL_ENABLED" = "true" ] && echo "${cyan}● Mainsail - Port:$MAINSAIL_PORT${default}" [ "$MAINSAIL_ENABLED" = "true" ] && echo " ${cyan}● Mainsail - Port:$MAINSAIL_PORT${default}"
[ "$FLUIDD_ENABLED" = "true" ] && echo "${cyan}● Fluidd - Port:$FLUIDD_PORT${default}" [ "$FLUIDD_ENABLED" = "true" ] && echo " ${cyan}● Fluidd - Port:$FLUIDD_PORT${default}"
[ "$DWC2_ENABLED" = "true" ] && echo "${cyan}● DWC2 - Port:$DWC2_PORT${default}" [ "$DWC2_ENABLED" = "true" ] && echo " ${cyan}● DWC2 - Port:$DWC2_PORT${default}"
if [ "$MAINSAIL_PORT" = "80" ] || [ "$DWC2_PORT" = "80" ] || [ "$FLUIDD_PORT" = "80" ]; then if [ "$MAINSAIL_PORT" = "80" ] || [ "$DWC2_PORT" = "80" ] || [ "$FLUIDD_PORT" = "80" ]; then
PORT_80_BLOCKED="true" 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 select_octoprint_port
fi fi
else else
@@ -167,16 +161,34 @@ octoprint_port_check(){
} }
select_octoprint_port(){ select_octoprint_port(){
while true; do if [ "$PORT_80_BLOCKED" = "true" ]; then
read -p "${cyan}Please enter a new Port:${default} " NEW_PORT echo
if [ "$NEW_PORT" != "$MAINSAIL_PORT" ] && [ "$NEW_PORT" != "$DWC2_PORT" ] && [ "$NEW_PORT" != "$FLUIDD_PORT" ]; then top_border
echo "Setting port $NEW_PORT for OctoPrint!" echo -e "| ${red}!!!WARNING!!!${default} |"
SET_LISTEN_PORT=$NEW_PORT echo -e "| ${red}You need to choose a different port for OctoPrint!${default} |"
break echo -e "| ${red}The following web interface is listening at port 80:${default} |"
else blank_line
echo "That port is already taken! Select a different one!" [ "$MAINSAIL_PORT" = "80" ] && echo "| ● Mainsail |"
fi [ "$FLUIDD_PORT" = "80" ] && echo "| ● Fluidd |"
done [ "$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" != "$FLUIDD_PORT" ] && [ "$NEW_PORT" != "$DWC2_PORT" ]; then
echo "Setting port $NEW_PORT for OctoPrint!"
SET_LISTEN_PORT=$NEW_PORT
break
else
echo "That port is already taken! Select a different one!"
fi
done
fi
} }
create_config_yaml(){ create_config_yaml(){