From 54ebd4f1fa48173a3ee244633ced467458ba7c60 Mon Sep 17 00:00:00 2001 From: Stefan Pejcic Date: Sat, 1 Feb 2025 00:18:03 +0100 Subject: [PATCH] Update install.sh --- install.sh | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/install.sh b/install.sh index 2e878d15..e381b21e 100644 --- a/install.sh +++ b/install.sh @@ -1184,29 +1184,12 @@ set_system_cronjob(){ set_custom_hostname(){ if [ "$SET_HOSTNAME_NOW" = true ]; then - # Check if the provided hostname is a valid FQDN - if [[ $new_hostname =~ ^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ ]]; then - # Check if PTR record is set to the provided hostname - ptr=$(dig +short -x $current_ip) - if [ "$ptr" != "$new_hostname." ]; then - echo "Warning: PTR record is not set to $new_hostname" - fi - - # Check if A record for provided hostname points to server IP - a_record_ip=$(dig +short $new_hostname) - if [ "$a_record_ip" != "$current_ip" ]; then - echo "WARNING: A record for $new_hostname does not point to server IP: $current_ip" - echo "After pointing the domain run this command to set domain for panel: opencli config update force_domain $new_hostname" - else - opencli config update force_domain "$new_hostname" - fi - + # Check if the provided hostname is a valid domain + if [[ $new_hostname =~ ^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ ]]; then + sed -i "s/example\.net/$new_hostname/g" /etc/openpanel/caddy/Caddyfile else echo "Hostname provided: $new_hostname is not a valid FQDN, OpenPanel will use IP address $current_ip for access." fi - - # Set the provided hostname as the system hostname - hostnamectl set-hostname $new_hostname fi }