mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
Update install.sh
This commit is contained in:
23
install.sh
23
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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user