diff --git a/lib/os/class.ISPConfigDebianOS.inc.php b/lib/os/class.ISPConfigDebianOS.inc.php index 996bd9a608de14abc964f6d6c78e8618e1ef5e9a..6eb1dab070753c5ed0bbe27135da4df771c0d0c7 100644 --- a/lib/os/class.ISPConfigDebianOS.inc.php +++ b/lib/os/class.ISPConfigDebianOS.inc.php @@ -469,6 +469,35 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"'; return false; } + ISPConfigLog::info('Checking hostname.', true); + + $host_name = false; + $cmd = 'hostname -f 2>&1'; + $check = $this->exec($cmd); + if($check === false) { + throw new ISPConfigOSException('Command ' . $cmd . ' failed.'); + } else { + $host_name = $check; + }/* elseif(trim($check) !== $host_name) { + ISPConfigLog::warn('Hostname mismatch: ' . $check . ' != ' . $host_name); + }*/ + + $cmd = 'hostname 2>&1'; + $check = $this->exec($cmd); + if($check === false) { + throw new ISPConfigOSException('Command ' . $cmd . ' failed.'); + }/* elseif(trim($check) !== $short_hostname) { + ISPConfigLog::warn('Short hostname mismatch: ' . $check . ' != ' . $short_hostname); + }*/ + + if($host_name == '') { + ISPConfigLog::error('Could not read the host name of your server. Please check it is correctly set.', true); + throw new ISPConfigOSException('Invalid host name or host name not found.'); + } elseif(substr_count($host_name, '.') < 2) { + ISPConfigLog::error('The host name ' . $host_name . ' of your server is no fully qualified domain name (xyz.domain.com). Please check it is correctly set.', true); + throw new ISPConfigOSException('Host name is no FQDN.'); + } + $this->configureApt(); $this->updatePackageList(); @@ -585,34 +614,6 @@ mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"'; ISPConfigLog::info('Server online again.', true); }*/ - ISPConfigLog::info('Checking hostname.', true); - - $host_name = false; - $cmd = 'hostname -f 2>&1'; - $check = $this->exec($cmd); - if($check === false) { - throw new ISPConfigOSException('Command ' . $cmd . ' failed.'); - } else { - $host_name = $check; - }/* elseif(trim($check) !== $host_name) { - ISPConfigLog::warn('Hostname mismatch: ' . $check . ' != ' . $host_name); - }*/ - - $cmd = 'hostname 2>&1'; - $check = $this->exec($cmd); - if($check === false) { - throw new ISPConfigOSException('Command ' . $cmd . ' failed.'); - }/* elseif(trim($check) !== $short_hostname) { - ISPConfigLog::warn('Short hostname mismatch: ' . $check . ' != ' . $short_hostname); - }*/ - - if($host_name == '') { - ISPConfigLog::error('Could not read the host name of your server. Please check it is correctly set.', true); - throw new ISPConfigOSException('Invalid host name or host name not found.'); - } elseif(substr_count($host_name, '.') < 2) { - ISPConfigLog::error('The host name ' . $host_name . ' of your server is no fully qualified domain name (xyz.domain.com). Please check it is correctly set.', true); - throw new ISPConfigOSException('Host name is no FQDN.'); - } $cmd = 'readlink /bin/sh 2>&1'; $check = trim($this->exec($cmd));