Set ComputerName and LocalHostName on darwin guests
This sets the bonjour host name for darwin guests to the same value as config.vm.hostname. It also sets the user-friendly name for the system.
This commit is contained in:
parent
6747f12951
commit
286e9cd01e
|
@ -4,7 +4,9 @@ module VagrantPlugins
|
||||||
class ChangeHostName
|
class ChangeHostName
|
||||||
def self.change_host_name(machine, name)
|
def self.change_host_name(machine, name)
|
||||||
if !machine.communicate.test("hostname -f | grep '^#{name}$' || hostname -s | grep '^#{name}$'")
|
if !machine.communicate.test("hostname -f | grep '^#{name}$' || hostname -s | grep '^#{name}$'")
|
||||||
|
machine.communicate.sudo("scutil --set ComputerName #{name}")
|
||||||
machine.communicate.sudo("scutil --set HostName #{name}")
|
machine.communicate.sudo("scutil --set HostName #{name}")
|
||||||
|
machine.communicate.sudo("scutil --set LocalHostName #{name}")
|
||||||
machine.communicate.sudo("hostname #{name}")
|
machine.communicate.sudo("hostname #{name}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue