diff --git a/scripts/self-hosted/install-server.sh b/scripts/self-hosted/install-server.sh index b10d306..bc0e04d 100755 --- a/scripts/self-hosted/install-server.sh +++ b/scripts/self-hosted/install-server.sh @@ -144,6 +144,12 @@ choose_ip_address() { header "$prompt" echo "$help_text" + if [ ${#ip_array[@]} -eq 0 ]; then + echo "$(red "No IP addresses found.")" + echo "$(red "Please check your network configuration.")" + exit 1 + fi + if [ ${#ip_array[@]} -eq 1 ]; then local chosen_ip="${ip_array[0]}" echo -e "$(green "Only one IP address available:") $(cyan "$chosen_ip")\n" @@ -214,7 +220,7 @@ get_user_credentials() { echo -e "\n$(green "Credentials saved successfully.")" } -IP_LIST=$(/tmp/ptah-agent list-ips) +IP_LIST="$(/tmp/ptah-agent list-ips | tr -d '\n')" choose_ip_address "$IP_LIST" "Advertised IP addresses" "ADVERTISE_ADDR" "$ADVERTISED_IP_HELP" choose_ip_address "$IP_LIST" "Public IP address" "PUBLIC_IP" "$PUBLIC_IP_HELP"