From 683a4671272b806ba2e1f0d62899f3bc53424975 Mon Sep 17 00:00:00 2001 From: Bohdan Shulha Date: Fri, 18 Oct 2024 19:52:48 +0200 Subject: [PATCH] fix: #239 ip address selection --- scripts/self-hosted/install-server.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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"