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

@@ -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,16 +33,34 @@ mainsail_port_check(){
}
select_mainsail_port(){
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
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
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(){