vaguerent/plugins/guests/darwin/cap/change_host_name.rb
Brian Johnson 5606aa8b1e Working implementation with NFS, still some caveats:
- There's a lengthy sleep in there, probably could use a back-off loop
- en1 seems totally worthless on vbox, I skip it and just use the en2 it creates.
2013-07-31 18:07:04 -07:00

15 lines
422 B
Ruby

module VagrantPlugins
module GuestDarwin
module Cap
class ChangeHostName
def self.change_host_name(machine, name)
if !machine.communicate.test("hostname -f | grep '^#{name}$' || hostname -s | grep '^#{name}$'")
machine.communicate.sudo("scutil --set HostName #{name}")
machine.communicate.sudo("hostname #{name}")
end
end
end
end
end
end