Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Oct 2017 13:54:54 +0000 (UTC)
From:      Glen Barber <gjb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325156 - head/release/tools
Message-ID:  <201710301354.v9UDssi8087756@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gjb
Date: Mon Oct 30 13:54:54 2017
New Revision: 325156
URL: https://svnweb.freebsd.org/changeset/base/325156

Log:
  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

Modified:
  head/release/tools/vmimage.subr

Modified: head/release/tools/vmimage.subr
==============================================================================
--- head/release/tools/vmimage.subr	Mon Oct 30 10:41:01 2017	(r325155)
+++ head/release/tools/vmimage.subr	Mon Oct 30 13:54:54 2017	(r325156)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710301354.v9UDssi8087756>