summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/hostname
diff options
context:
space:
mode:
Diffstat (limited to 'etc/rc.d/hostname')
-rw-r--r--etc/rc.d/hostname8
1 files changed, 8 insertions, 0 deletions
diff --git a/etc/rc.d/hostname b/etc/rc.d/hostname
index f740cde..65b6ba2 100644
--- a/etc/rc.d/hostname
+++ b/etc/rc.d/hostname
@@ -49,6 +49,14 @@ hostname_start()
fi
elif [ -n "`hostname -s`" ]; then
return
+ else
+ # If we're not in a jail and rc.conf doesn't specify a
+ # hostname, see if we can get one from kenv.
+ #
+ if [ -z "${hostname}" -a \
+ -n "`/bin/kenv dhcp.host-name 2> /dev/null`" ]; then
+ hostname=`/bin/kenv dhcp.host-name`
+ fi
fi
hostname ${hostname}
OpenPOWER on IntegriCloud