If no hostname is set, use mac address to generate one.

Currently not working very well in hyperkit due to https://github.com/docker/vpnkit/issues/190

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack
2017-02-28 17:42:40 -08:00
parent 32e58591b6
commit bcff238cf2
2 changed files with 11 additions and 2 deletions

View File

@@ -83,7 +83,16 @@ done
mdev -s
# set hostname
[ -s /etc/hostname ] && hostname -F /etc/hostname
if [ -s /etc/hostname ]
then
hostname -F /etc/hostname
fi
if [ $(hostname) = "moby" -a -f /sys/class/net/eth0/address ]
then
mac=$(cat /sys/class/net/eth0/address)
hostname moby-$(echo $mac | sed 's/://g')
fi
# set system clock from hwclock
hwclock --hctosys --utc