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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to