Set a default hostname for virtual machine images.

A recent bug in security/sudo causes segmentation faults when
the system is not configured with a hostname, which causes issues
with some virtual machine setups, notably Vagrant.  Set the default
hostname to the output of 'uname -o'.

Submitted by:	Nicholas Fiorentini
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
gjb 2017-10-30 13:54:54 +00:00
parent 6b23b8248c
commit e2b3cfc07c

View File

@ -140,6 +140,10 @@ vm_install_base() {
>> ${DESTDIR}/etc/fstab
fi
local hostname
hostname="$(echo $(uname -o) | tr '[:upper:]' '[:lower:]')"
echo "hostname=\"${hostname}\"" >> ${DESTDIR}/etc/rc.conf
mkdir -p ${DESTDIR}/dev
mount -t devfs devfs ${DESTDIR}/dev
chroot ${DESTDIR} /usr/bin/newaliases