From 3ebde12efbe3daa4bca1ce9839e305425b310986 Mon Sep 17 00:00:00 2001 From: Ian Downes Date: Wed, 22 Feb 2012 15:08:18 -0800 Subject: [PATCH] add change_host_name support for FreeBSD --- lib/vagrant/guest/freebsd.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/vagrant/guest/freebsd.rb b/lib/vagrant/guest/freebsd.rb index 5f4e2225a..544386f9a 100644 --- a/lib/vagrant/guest/freebsd.rb +++ b/lib/vagrant/guest/freebsd.rb @@ -70,6 +70,13 @@ module Vagrant vm.channel.sudo("ifconfig em#{network[:interface]} inet #{network[:ip]} netmask #{network[:netmask]}") end end + + def change_host_name(name) + if !vm.channel.test("hostname -f | grep '^#{name}$' || hostname -s | grep '^#{name}$'") + vm.channel.sudo("sed -i '' 's/hostname=.*$/hostname=#{name}/' /etc/rc.conf") + vm.channel.sudo("hostname #{name}") + end + end end end end