feat: implement smart IP detection and automated configuration

This commit is contained in:
Haitao Pan 2026-02-02 23:38:05 +08:00
parent a2500607ee
commit 13e68be5ee
2 changed files with 16 additions and 3 deletions

8
configure vendored
View File

@ -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

View File

@ -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"