From d0aee33dc9adcb0193a3b1f13961b2f7c2504375 Mon Sep 17 00:00:00 2001 From: Jamie Gritton Date: Sat, 10 Mar 2018 20:13:07 +0000 Subject: [PATCH] Don't warn when the "hostname" rc variable is unset, but the hostname is already non-empty (common in jails). --- etc/rc.d/hostname | 6 ++++-- share/man/man5/rc.conf.5 | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/etc/rc.d/hostname b/etc/rc.d/hostname index 6b5d350fe2e3..148b61fd68f2 100755 --- a/etc/rc.d/hostname +++ b/etc/rc.d/hostname @@ -60,9 +60,11 @@ hostname_start() # Have we got a hostname yet? # 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)." fi return diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index c27a2134e6bc..317de23a1d9a 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2018 +.Dd March 10, 2018 .Dt RC.CONF 5 .Os .Sh NAME @@ -421,6 +421,9 @@ If .Xr dhclient 8 is used to set the hostname via DHCP, 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 your console login will display the default hostname of .Dq Amnesiac .