mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-04 00:17:06 +00:00
ensure system hostname is resolvable locally
This commit is contained in:
parent
71d3b79965
commit
f8a679b9c2
@ -62,6 +62,9 @@ set_system_hostname() {
|
||||
local fqdn="${1:-$PRIMARY_HOSTNAME}"
|
||||
local host="$(awk -F. '{print $1}' <<< "$fqdn")"
|
||||
sed -i 's/^127\.0\.1\.1[ \t].*/127.0.1.1 '"$fqdn $host ip4-loopback/" /etc/hosts || return 1
|
||||
if ! /usr/bin/getent hosts "$fqdn" >/dev/null; then
|
||||
return 2
|
||||
fi
|
||||
#hostname "$host" || return 1
|
||||
#echo "$host" > /etc/hostname
|
||||
return 0
|
||||
|
@ -69,7 +69,10 @@ dump_conf_files() {
|
||||
#
|
||||
init_test_system() {
|
||||
H2 "Update /etc/hosts"
|
||||
set_system_hostname || die "Could not set hostname"
|
||||
if ! set_system_hostname; then
|
||||
dump_file "/etc/hosts"
|
||||
die "Could not set hostname"
|
||||
fi
|
||||
|
||||
# update system time
|
||||
H2 "Set system time"
|
||||
|
Loading…
Reference in New Issue
Block a user