mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-05 00:27:25 +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 fqdn="${1:-$PRIMARY_HOSTNAME}"
|
||||||
local host="$(awk -F. '{print $1}' <<< "$fqdn")"
|
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
|
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
|
#hostname "$host" || return 1
|
||||||
#echo "$host" > /etc/hostname
|
#echo "$host" > /etc/hostname
|
||||||
return 0
|
return 0
|
||||||
|
@ -69,7 +69,10 @@ dump_conf_files() {
|
|||||||
#
|
#
|
||||||
init_test_system() {
|
init_test_system() {
|
||||||
H2 "Update /etc/hosts"
|
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
|
# update system time
|
||||||
H2 "Set system time"
|
H2 "Set system time"
|
||||||
|
Loading…
Reference in New Issue
Block a user