diff --git a/install-update-srs.sh b/install-update-srs.sh index 3de993f..419b97b 100755 --- a/install-update-srs.sh +++ b/install-update-srs.sh @@ -232,8 +232,19 @@ read_config_domain_hint() { # First user interaction, before any installation/prerequisite checks. # The shared Git script never has a server-specific domain hardcoded. prompt_srs_domain() { - local answer='' + local answer='' host_fqdn='' read_config_domain_hint + + # For a first installation, suggest srs.. + # A configured SRS domain always takes precedence. + if [[ -z "$CONFIG_DOMAIN_HINT" ]]; then + host_fqdn="$(hostname -f 2>/dev/null || true)" + host_fqdn="${host_fqdn,,}" + if [[ "$host_fqdn" =~ ^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?[.])+[a-z]{2,63}$ ]] && + (( ${#host_fqdn} <= 249 )); then + CONFIG_DOMAIN_HINT="srs.${host_fqdn}" + fi + fi echo echo 'Selective SRS - domain selection' echo