Don't warn when the "hostname" rc variable is unset, but the hostname

is already non-empty (common in jails).
This commit is contained in:
Jamie Gritton 2018-03-10 20:13:07 +00:00
parent f270fabc2b
commit d0aee33dc9
2 changed files with 8 additions and 3 deletions

View File

@ -60,9 +60,11 @@ hostname_start()
# Have we got a hostname yet? # Have we got a hostname yet?
# #
if [ -z "${hostname}" ]; then if [ -z "${hostname}" ]; then
# Null hostname is probably OK if DHCP is in use. # Null hostname is probably OK if DHCP is in use,
# or when hostname is already set (common for jails).
# #
if [ -z "`list_net_interfaces dhcp`" ]; then if [ -z "`list_net_interfaces dhcp`" -a \
-z "`/bin/hostname`" ]; then
warn "\$hostname is not set -- see rc.conf(5)." warn "\$hostname is not set -- see rc.conf(5)."
fi fi
return return

View File

@ -24,7 +24,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd February 15, 2018 .Dd March 10, 2018
.Dt RC.CONF 5 .Dt RC.CONF 5
.Os .Os
.Sh NAME .Sh NAME
@ -421,6 +421,9 @@ If
.Xr dhclient 8 .Xr dhclient 8
is used to set the hostname via DHCP, is used to set the hostname via DHCP,
this variable should be set to an empty string. this variable should be set to an empty string.
Within a
.Xr jail 8
the hostname is generally already set and this variable may absent.
If this value remains unset when the system is done booting If this value remains unset when the system is done booting
your console login will display the default hostname of your console login will display the default hostname of
.Dq Amnesiac . .Dq Amnesiac .