Merge pull request #757 from ndwns/freebsd-hostname

add change_host_name support for FreeBSD
This commit is contained in:
Mitchell Hashimoto 2012-02-22 15:15:19 -08:00
commit 6a1ca3402c
1 changed files with 7 additions and 0 deletions

View File

@ -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