From 13e68be5eeb8c5614cd686150362caf40e1d8cfa Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Mon, 2 Feb 2026 23:38:05 +0800 Subject: [PATCH] feat: implement smart IP detection and automated configuration --- configure | 8 ++++++++ scripts/server-install.sh | 11 ++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 2637c1c..76c9fa8 100755 --- a/configure +++ b/configure @@ -398,6 +398,14 @@ function check_ipaddr(){ return 0 fi + # multiple IP detected, try to find the "best" one (non-docker, non-loopback) + local best_ip=$(hostname --all-ip-addresses | tr ' ' '\n' | grep -vE '^(127\.|172\.(1[6-9]|2[0-9]|3[01])\.|169\.254\.)' | head -n1) + if [[ -n "${best_ip}" && ${interactive} != "true" ]]; then + log_info "primary_ip = ${best_ip} (auto-selected from multiple)" + PRIMARY_IP=${best_ip} + return 0 + fi + # multiple IP detected log_warn "Multiple IP address candidates found:" list_ipaddr diff --git a/scripts/server-install.sh b/scripts/server-install.sh index 7eb85fb..0e00b48 100644 --- a/scripts/server-install.sh +++ b/scripts/server-install.sh @@ -106,8 +106,13 @@ else echo -e "${RED}Warning: Primary setup scripts not found! Check repo content.${NC}" fi -echo -e "${GREEN}Installation successful!${NC}" +# Run Configure automatically +if [ -f "./configure" ]; then + echo -e "${BLUE}Running configure (auto-detecting IP)...${NC}" + ./configure -n || { echo -e "${RED}Error: Configure failed${NC}"; exit 1; } +fi + +echo -e "${GREEN}Installation and configuration successful!${NC}" echo -e "Next steps:" echo -e " cd ${INSTALL_DIR}" -echo -e " ./configure # Generate config" -echo -e " ./deploy.yml # Install" +echo -e " ./deploy.yml # Run this to start the actual deployment"