aboutsummaryrefslogtreecommitdiff
path: root/release/tools/vmimage.subr
diff options
context:
space:
mode:
authorGlen Barber <gjb@FreeBSD.org>2017-10-30 13:54:54 +0000
committerGlen Barber <gjb@FreeBSD.org>2017-10-30 13:54:54 +0000
commit2170fff8a596fb3a19eae7f611ba3646b26c89cd (patch)
tree57dd4342689a84ebcae69460d714f113ae288bdd /release/tools/vmimage.subr
parent7e1929345068a1ddb64098dd678d8c3d5d9fcf14 (diff)
downloadsrc-2170fff8a596fb3a19eae7f611ba3646b26c89cd.tar.gz
src-2170fff8a596fb3a19eae7f611ba3646b26c89cd.zip
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
Notes
Notes: svn path=/head/; revision=325156
Diffstat (limited to 'release/tools/vmimage.subr')
-rw-r--r--release/tools/vmimage.subr4
1 files changed, 4 insertions, 0 deletions
diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr
index 3039e2efb5f9..6ba7e185a33f 100644
--- a/release/tools/vmimage.subr
+++ b/release/tools/vmimage.subr
@@ -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