Use hostnamectl in plugins/guests/arch/cap/change_host_name.rb
This commit is contained in:
parent
53f214c451
commit
903578269b
|
@ -6,8 +6,7 @@ module VagrantPlugins
|
|||
machine.communicate.tap do |comm|
|
||||
# Only do this if the hostname is not already set
|
||||
if !comm.test("sudo hostname | grep '#{name}'")
|
||||
comm.sudo("sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/rc.conf")
|
||||
comm.sudo("hostname #{name}")
|
||||
comm.sudo("hostnamectl set-hostname #{name}")
|
||||
comm.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} @' /etc/hosts")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue