From: Michael Tremer Date: Tue, 29 Sep 2020 13:47:09 +0000 (+0000) Subject: exoscale: Fix assigning domain name X-Git-Tag: v2.25-core151~8^2~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=df8920100d8e853f28e3b9aa29182596a79dc129;p=ipfire-2.x.git exoscale: Fix assigning domain name The whole hostname was used as domain name because there was no . in it where the string could have been split. Signed-off-by: Michael Tremer --- diff --git a/src/initscripts/helper/exoscale-setup b/src/initscripts/helper/exoscale-setup index 59859a6e92..24e98d38ba 100644 --- a/src/initscripts/helper/exoscale-setup +++ b/src/initscripts/helper/exoscale-setup @@ -33,10 +33,13 @@ import_exoscale_configuration() { # Set domainname if ! grep -q "^DOMAINNAME=" /var/ipfire/main/settings; then - local domainname="${hostname#*.}" + local domainname="localdomain" - # Fall back to localdomain - [ -z "${domainname}" ] && domainname="localdomain" + # If the hostname contains a dot we strip the last + # part and use it as our domain name + if [[ ${hostname} =~ "\." ]]; then + domainname="${hostname#*.}" + fi echo "DOMAINNAME=${domainname}" >> /var/ipfire/main/settings fi